@aws-sdk/client-sns 3.51.0 → 3.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,8 @@ const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const entities_1 = require("entities");
8
8
  const fast_xml_parser_1 = require("fast-xml-parser");
9
+ const models_0_1 = require("../models/models_0");
10
+ const SNSServiceException_1 = require("../models/SNSServiceException");
9
11
  const serializeAws_queryAddPermissionCommand = async (input, context) => {
10
12
  const headers = {
11
13
  "content-type": "application/x-www-form-urlencoded",
@@ -548,51 +550,25 @@ const deserializeAws_queryAddPermissionCommandError = async (output, context) =>
548
550
  switch (errorCode) {
549
551
  case "AuthorizationErrorException":
550
552
  case "com.amazonaws.sns#AuthorizationErrorException":
551
- response = {
552
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
553
- name: errorCode,
554
- $metadata: deserializeMetadata(output),
555
- };
556
- break;
553
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
557
554
  case "InternalErrorException":
558
555
  case "com.amazonaws.sns#InternalErrorException":
559
- response = {
560
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
561
- name: errorCode,
562
- $metadata: deserializeMetadata(output),
563
- };
564
- break;
556
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
565
557
  case "InvalidParameterException":
566
558
  case "com.amazonaws.sns#InvalidParameterException":
567
- response = {
568
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
569
- name: errorCode,
570
- $metadata: deserializeMetadata(output),
571
- };
572
- break;
559
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
573
560
  case "NotFoundException":
574
561
  case "com.amazonaws.sns#NotFoundException":
575
- response = {
576
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
577
- name: errorCode,
578
- $metadata: deserializeMetadata(output),
579
- };
580
- break;
562
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
581
563
  default:
582
564
  const parsedBody = parsedOutput.body;
583
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
584
- response = {
585
- ...parsedBody.Error,
586
- name: `${errorCode}`,
587
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
565
+ response = new SNSServiceException_1.SNSServiceException({
566
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
588
567
  $fault: "client",
589
568
  $metadata: deserializeMetadata(output),
590
- };
569
+ });
570
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
591
571
  }
592
- const message = response.message || response.Message || errorCode;
593
- response.message = message;
594
- delete response.Message;
595
- return Promise.reject(Object.assign(new Error(message), response));
596
572
  };
597
573
  const deserializeAws_queryCheckIfPhoneNumberIsOptedOutCommand = async (output, context) => {
598
574
  if (output.statusCode >= 300) {
@@ -619,51 +595,25 @@ const deserializeAws_queryCheckIfPhoneNumberIsOptedOutCommandError = async (outp
619
595
  switch (errorCode) {
620
596
  case "AuthorizationErrorException":
621
597
  case "com.amazonaws.sns#AuthorizationErrorException":
622
- response = {
623
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
624
- name: errorCode,
625
- $metadata: deserializeMetadata(output),
626
- };
627
- break;
598
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
628
599
  case "InternalErrorException":
629
600
  case "com.amazonaws.sns#InternalErrorException":
630
- response = {
631
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
632
- name: errorCode,
633
- $metadata: deserializeMetadata(output),
634
- };
635
- break;
601
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
636
602
  case "InvalidParameterException":
637
603
  case "com.amazonaws.sns#InvalidParameterException":
638
- response = {
639
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
640
- name: errorCode,
641
- $metadata: deserializeMetadata(output),
642
- };
643
- break;
604
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
644
605
  case "ThrottledException":
645
606
  case "com.amazonaws.sns#ThrottledException":
646
- response = {
647
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
648
- name: errorCode,
649
- $metadata: deserializeMetadata(output),
650
- };
651
- break;
607
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
652
608
  default:
653
609
  const parsedBody = parsedOutput.body;
654
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
655
- response = {
656
- ...parsedBody.Error,
657
- name: `${errorCode}`,
658
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
610
+ response = new SNSServiceException_1.SNSServiceException({
611
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
659
612
  $fault: "client",
660
613
  $metadata: deserializeMetadata(output),
661
- };
614
+ });
615
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
662
616
  }
663
- const message = response.message || response.Message || errorCode;
664
- response.message = message;
665
- delete response.Message;
666
- return Promise.reject(Object.assign(new Error(message), response));
667
617
  };
668
618
  const deserializeAws_queryConfirmSubscriptionCommand = async (output, context) => {
669
619
  if (output.statusCode >= 300) {
@@ -690,67 +640,31 @@ const deserializeAws_queryConfirmSubscriptionCommandError = async (output, conte
690
640
  switch (errorCode) {
691
641
  case "AuthorizationErrorException":
692
642
  case "com.amazonaws.sns#AuthorizationErrorException":
693
- response = {
694
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
695
- name: errorCode,
696
- $metadata: deserializeMetadata(output),
697
- };
698
- break;
643
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
699
644
  case "FilterPolicyLimitExceededException":
700
645
  case "com.amazonaws.sns#FilterPolicyLimitExceededException":
701
- response = {
702
- ...(await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context)),
703
- name: errorCode,
704
- $metadata: deserializeMetadata(output),
705
- };
706
- break;
646
+ throw await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context);
707
647
  case "InternalErrorException":
708
648
  case "com.amazonaws.sns#InternalErrorException":
709
- response = {
710
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
711
- name: errorCode,
712
- $metadata: deserializeMetadata(output),
713
- };
714
- break;
649
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
715
650
  case "InvalidParameterException":
716
651
  case "com.amazonaws.sns#InvalidParameterException":
717
- response = {
718
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
719
- name: errorCode,
720
- $metadata: deserializeMetadata(output),
721
- };
722
- break;
652
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
723
653
  case "NotFoundException":
724
654
  case "com.amazonaws.sns#NotFoundException":
725
- response = {
726
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
727
- name: errorCode,
728
- $metadata: deserializeMetadata(output),
729
- };
730
- break;
655
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
731
656
  case "SubscriptionLimitExceededException":
732
657
  case "com.amazonaws.sns#SubscriptionLimitExceededException":
733
- response = {
734
- ...(await deserializeAws_querySubscriptionLimitExceededExceptionResponse(parsedOutput, context)),
735
- name: errorCode,
736
- $metadata: deserializeMetadata(output),
737
- };
738
- break;
658
+ throw await deserializeAws_querySubscriptionLimitExceededExceptionResponse(parsedOutput, context);
739
659
  default:
740
660
  const parsedBody = parsedOutput.body;
741
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
742
- response = {
743
- ...parsedBody.Error,
744
- name: `${errorCode}`,
745
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
661
+ response = new SNSServiceException_1.SNSServiceException({
662
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
746
663
  $fault: "client",
747
664
  $metadata: deserializeMetadata(output),
748
- };
665
+ });
666
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
749
667
  }
750
- const message = response.message || response.Message || errorCode;
751
- response.message = message;
752
- delete response.Message;
753
- return Promise.reject(Object.assign(new Error(message), response));
754
668
  };
755
669
  const deserializeAws_queryCreatePlatformApplicationCommand = async (output, context) => {
756
670
  if (output.statusCode >= 300) {
@@ -777,43 +691,22 @@ const deserializeAws_queryCreatePlatformApplicationCommandError = async (output,
777
691
  switch (errorCode) {
778
692
  case "AuthorizationErrorException":
779
693
  case "com.amazonaws.sns#AuthorizationErrorException":
780
- response = {
781
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
782
- name: errorCode,
783
- $metadata: deserializeMetadata(output),
784
- };
785
- break;
694
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
786
695
  case "InternalErrorException":
787
696
  case "com.amazonaws.sns#InternalErrorException":
788
- response = {
789
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
790
- name: errorCode,
791
- $metadata: deserializeMetadata(output),
792
- };
793
- break;
697
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
794
698
  case "InvalidParameterException":
795
699
  case "com.amazonaws.sns#InvalidParameterException":
796
- response = {
797
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
798
- name: errorCode,
799
- $metadata: deserializeMetadata(output),
800
- };
801
- break;
700
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
802
701
  default:
803
702
  const parsedBody = parsedOutput.body;
804
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
805
- response = {
806
- ...parsedBody.Error,
807
- name: `${errorCode}`,
808
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
703
+ response = new SNSServiceException_1.SNSServiceException({
704
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
809
705
  $fault: "client",
810
706
  $metadata: deserializeMetadata(output),
811
- };
707
+ });
708
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
812
709
  }
813
- const message = response.message || response.Message || errorCode;
814
- response.message = message;
815
- delete response.Message;
816
- return Promise.reject(Object.assign(new Error(message), response));
817
710
  };
818
711
  const deserializeAws_queryCreatePlatformEndpointCommand = async (output, context) => {
819
712
  if (output.statusCode >= 300) {
@@ -840,51 +733,25 @@ const deserializeAws_queryCreatePlatformEndpointCommandError = async (output, co
840
733
  switch (errorCode) {
841
734
  case "AuthorizationErrorException":
842
735
  case "com.amazonaws.sns#AuthorizationErrorException":
843
- response = {
844
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
845
- name: errorCode,
846
- $metadata: deserializeMetadata(output),
847
- };
848
- break;
736
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
849
737
  case "InternalErrorException":
850
738
  case "com.amazonaws.sns#InternalErrorException":
851
- response = {
852
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
853
- name: errorCode,
854
- $metadata: deserializeMetadata(output),
855
- };
856
- break;
739
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
857
740
  case "InvalidParameterException":
858
741
  case "com.amazonaws.sns#InvalidParameterException":
859
- response = {
860
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
861
- name: errorCode,
862
- $metadata: deserializeMetadata(output),
863
- };
864
- break;
742
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
865
743
  case "NotFoundException":
866
744
  case "com.amazonaws.sns#NotFoundException":
867
- response = {
868
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
869
- name: errorCode,
870
- $metadata: deserializeMetadata(output),
871
- };
872
- break;
745
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
873
746
  default:
874
747
  const parsedBody = parsedOutput.body;
875
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
876
- response = {
877
- ...parsedBody.Error,
878
- name: `${errorCode}`,
879
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
748
+ response = new SNSServiceException_1.SNSServiceException({
749
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
880
750
  $fault: "client",
881
751
  $metadata: deserializeMetadata(output),
882
- };
752
+ });
753
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
883
754
  }
884
- const message = response.message || response.Message || errorCode;
885
- response.message = message;
886
- delete response.Message;
887
- return Promise.reject(Object.assign(new Error(message), response));
888
755
  };
889
756
  const deserializeAws_queryCreateSMSSandboxPhoneNumberCommand = async (output, context) => {
890
757
  if (output.statusCode >= 300) {
@@ -911,67 +778,31 @@ const deserializeAws_queryCreateSMSSandboxPhoneNumberCommandError = async (outpu
911
778
  switch (errorCode) {
912
779
  case "AuthorizationErrorException":
913
780
  case "com.amazonaws.sns#AuthorizationErrorException":
914
- response = {
915
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
916
- name: errorCode,
917
- $metadata: deserializeMetadata(output),
918
- };
919
- break;
781
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
920
782
  case "InternalErrorException":
921
783
  case "com.amazonaws.sns#InternalErrorException":
922
- response = {
923
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
924
- name: errorCode,
925
- $metadata: deserializeMetadata(output),
926
- };
927
- break;
784
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
928
785
  case "InvalidParameterException":
929
786
  case "com.amazonaws.sns#InvalidParameterException":
930
- response = {
931
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
932
- name: errorCode,
933
- $metadata: deserializeMetadata(output),
934
- };
935
- break;
787
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
936
788
  case "OptedOutException":
937
789
  case "com.amazonaws.sns#OptedOutException":
938
- response = {
939
- ...(await deserializeAws_queryOptedOutExceptionResponse(parsedOutput, context)),
940
- name: errorCode,
941
- $metadata: deserializeMetadata(output),
942
- };
943
- break;
790
+ throw await deserializeAws_queryOptedOutExceptionResponse(parsedOutput, context);
944
791
  case "ThrottledException":
945
792
  case "com.amazonaws.sns#ThrottledException":
946
- response = {
947
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
948
- name: errorCode,
949
- $metadata: deserializeMetadata(output),
950
- };
951
- break;
793
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
952
794
  case "UserErrorException":
953
795
  case "com.amazonaws.sns#UserErrorException":
954
- response = {
955
- ...(await deserializeAws_queryUserErrorExceptionResponse(parsedOutput, context)),
956
- name: errorCode,
957
- $metadata: deserializeMetadata(output),
958
- };
959
- break;
796
+ throw await deserializeAws_queryUserErrorExceptionResponse(parsedOutput, context);
960
797
  default:
961
798
  const parsedBody = parsedOutput.body;
962
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
963
- response = {
964
- ...parsedBody.Error,
965
- name: `${errorCode}`,
966
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
799
+ response = new SNSServiceException_1.SNSServiceException({
800
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
967
801
  $fault: "client",
968
802
  $metadata: deserializeMetadata(output),
969
- };
803
+ });
804
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
970
805
  }
971
- const message = response.message || response.Message || errorCode;
972
- response.message = message;
973
- delete response.Message;
974
- return Promise.reject(Object.assign(new Error(message), response));
975
806
  };
976
807
  const deserializeAws_queryCreateTopicCommand = async (output, context) => {
977
808
  if (output.statusCode >= 300) {
@@ -998,91 +829,40 @@ const deserializeAws_queryCreateTopicCommandError = async (output, context) => {
998
829
  switch (errorCode) {
999
830
  case "AuthorizationErrorException":
1000
831
  case "com.amazonaws.sns#AuthorizationErrorException":
1001
- response = {
1002
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1003
- name: errorCode,
1004
- $metadata: deserializeMetadata(output),
1005
- };
1006
- break;
832
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1007
833
  case "ConcurrentAccessException":
1008
834
  case "com.amazonaws.sns#ConcurrentAccessException":
1009
- response = {
1010
- ...(await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context)),
1011
- name: errorCode,
1012
- $metadata: deserializeMetadata(output),
1013
- };
1014
- break;
835
+ throw await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context);
1015
836
  case "InternalErrorException":
1016
837
  case "com.amazonaws.sns#InternalErrorException":
1017
- response = {
1018
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1019
- name: errorCode,
1020
- $metadata: deserializeMetadata(output),
1021
- };
1022
- break;
838
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1023
839
  case "InvalidParameterException":
1024
840
  case "com.amazonaws.sns#InvalidParameterException":
1025
- response = {
1026
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1027
- name: errorCode,
1028
- $metadata: deserializeMetadata(output),
1029
- };
1030
- break;
841
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1031
842
  case "InvalidSecurityException":
1032
843
  case "com.amazonaws.sns#InvalidSecurityException":
1033
- response = {
1034
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
1035
- name: errorCode,
1036
- $metadata: deserializeMetadata(output),
1037
- };
1038
- break;
844
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
1039
845
  case "StaleTagException":
1040
846
  case "com.amazonaws.sns#StaleTagException":
1041
- response = {
1042
- ...(await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context)),
1043
- name: errorCode,
1044
- $metadata: deserializeMetadata(output),
1045
- };
1046
- break;
847
+ throw await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context);
1047
848
  case "TagLimitExceededException":
1048
849
  case "com.amazonaws.sns#TagLimitExceededException":
1049
- response = {
1050
- ...(await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context)),
1051
- name: errorCode,
1052
- $metadata: deserializeMetadata(output),
1053
- };
1054
- break;
850
+ throw await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context);
1055
851
  case "TagPolicyException":
1056
852
  case "com.amazonaws.sns#TagPolicyException":
1057
- response = {
1058
- ...(await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context)),
1059
- name: errorCode,
1060
- $metadata: deserializeMetadata(output),
1061
- };
1062
- break;
853
+ throw await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context);
1063
854
  case "TopicLimitExceededException":
1064
855
  case "com.amazonaws.sns#TopicLimitExceededException":
1065
- response = {
1066
- ...(await deserializeAws_queryTopicLimitExceededExceptionResponse(parsedOutput, context)),
1067
- name: errorCode,
1068
- $metadata: deserializeMetadata(output),
1069
- };
1070
- break;
856
+ throw await deserializeAws_queryTopicLimitExceededExceptionResponse(parsedOutput, context);
1071
857
  default:
1072
858
  const parsedBody = parsedOutput.body;
1073
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1074
- response = {
1075
- ...parsedBody.Error,
1076
- name: `${errorCode}`,
1077
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
859
+ response = new SNSServiceException_1.SNSServiceException({
860
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1078
861
  $fault: "client",
1079
862
  $metadata: deserializeMetadata(output),
1080
- };
863
+ });
864
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1081
865
  }
1082
- const message = response.message || response.Message || errorCode;
1083
- response.message = message;
1084
- delete response.Message;
1085
- return Promise.reject(Object.assign(new Error(message), response));
1086
866
  };
1087
867
  const deserializeAws_queryDeleteEndpointCommand = async (output, context) => {
1088
868
  if (output.statusCode >= 300) {
@@ -1106,43 +886,22 @@ const deserializeAws_queryDeleteEndpointCommandError = async (output, context) =
1106
886
  switch (errorCode) {
1107
887
  case "AuthorizationErrorException":
1108
888
  case "com.amazonaws.sns#AuthorizationErrorException":
1109
- response = {
1110
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1111
- name: errorCode,
1112
- $metadata: deserializeMetadata(output),
1113
- };
1114
- break;
889
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1115
890
  case "InternalErrorException":
1116
891
  case "com.amazonaws.sns#InternalErrorException":
1117
- response = {
1118
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1119
- name: errorCode,
1120
- $metadata: deserializeMetadata(output),
1121
- };
1122
- break;
892
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1123
893
  case "InvalidParameterException":
1124
894
  case "com.amazonaws.sns#InvalidParameterException":
1125
- response = {
1126
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1127
- name: errorCode,
1128
- $metadata: deserializeMetadata(output),
1129
- };
1130
- break;
895
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1131
896
  default:
1132
897
  const parsedBody = parsedOutput.body;
1133
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1134
- response = {
1135
- ...parsedBody.Error,
1136
- name: `${errorCode}`,
1137
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
898
+ response = new SNSServiceException_1.SNSServiceException({
899
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1138
900
  $fault: "client",
1139
901
  $metadata: deserializeMetadata(output),
1140
- };
902
+ });
903
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1141
904
  }
1142
- const message = response.message || response.Message || errorCode;
1143
- response.message = message;
1144
- delete response.Message;
1145
- return Promise.reject(Object.assign(new Error(message), response));
1146
905
  };
1147
906
  const deserializeAws_queryDeletePlatformApplicationCommand = async (output, context) => {
1148
907
  if (output.statusCode >= 300) {
@@ -1166,43 +925,22 @@ const deserializeAws_queryDeletePlatformApplicationCommandError = async (output,
1166
925
  switch (errorCode) {
1167
926
  case "AuthorizationErrorException":
1168
927
  case "com.amazonaws.sns#AuthorizationErrorException":
1169
- response = {
1170
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1171
- name: errorCode,
1172
- $metadata: deserializeMetadata(output),
1173
- };
1174
- break;
928
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1175
929
  case "InternalErrorException":
1176
930
  case "com.amazonaws.sns#InternalErrorException":
1177
- response = {
1178
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1179
- name: errorCode,
1180
- $metadata: deserializeMetadata(output),
1181
- };
1182
- break;
931
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1183
932
  case "InvalidParameterException":
1184
933
  case "com.amazonaws.sns#InvalidParameterException":
1185
- response = {
1186
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1187
- name: errorCode,
1188
- $metadata: deserializeMetadata(output),
1189
- };
1190
- break;
934
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1191
935
  default:
1192
936
  const parsedBody = parsedOutput.body;
1193
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1194
- response = {
1195
- ...parsedBody.Error,
1196
- name: `${errorCode}`,
1197
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
937
+ response = new SNSServiceException_1.SNSServiceException({
938
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1198
939
  $fault: "client",
1199
940
  $metadata: deserializeMetadata(output),
1200
- };
941
+ });
942
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1201
943
  }
1202
- const message = response.message || response.Message || errorCode;
1203
- response.message = message;
1204
- delete response.Message;
1205
- return Promise.reject(Object.assign(new Error(message), response));
1206
944
  };
1207
945
  const deserializeAws_queryDeleteSMSSandboxPhoneNumberCommand = async (output, context) => {
1208
946
  if (output.statusCode >= 300) {
@@ -1229,67 +967,31 @@ const deserializeAws_queryDeleteSMSSandboxPhoneNumberCommandError = async (outpu
1229
967
  switch (errorCode) {
1230
968
  case "AuthorizationErrorException":
1231
969
  case "com.amazonaws.sns#AuthorizationErrorException":
1232
- response = {
1233
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1234
- name: errorCode,
1235
- $metadata: deserializeMetadata(output),
1236
- };
1237
- break;
970
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1238
971
  case "InternalErrorException":
1239
972
  case "com.amazonaws.sns#InternalErrorException":
1240
- response = {
1241
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1242
- name: errorCode,
1243
- $metadata: deserializeMetadata(output),
1244
- };
1245
- break;
973
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1246
974
  case "InvalidParameterException":
1247
975
  case "com.amazonaws.sns#InvalidParameterException":
1248
- response = {
1249
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1250
- name: errorCode,
1251
- $metadata: deserializeMetadata(output),
1252
- };
1253
- break;
976
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1254
977
  case "ResourceNotFoundException":
1255
978
  case "com.amazonaws.sns#ResourceNotFoundException":
1256
- response = {
1257
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1258
- name: errorCode,
1259
- $metadata: deserializeMetadata(output),
1260
- };
1261
- break;
979
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1262
980
  case "ThrottledException":
1263
981
  case "com.amazonaws.sns#ThrottledException":
1264
- response = {
1265
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
1266
- name: errorCode,
1267
- $metadata: deserializeMetadata(output),
1268
- };
1269
- break;
982
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
1270
983
  case "UserErrorException":
1271
984
  case "com.amazonaws.sns#UserErrorException":
1272
- response = {
1273
- ...(await deserializeAws_queryUserErrorExceptionResponse(parsedOutput, context)),
1274
- name: errorCode,
1275
- $metadata: deserializeMetadata(output),
1276
- };
1277
- break;
985
+ throw await deserializeAws_queryUserErrorExceptionResponse(parsedOutput, context);
1278
986
  default:
1279
987
  const parsedBody = parsedOutput.body;
1280
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1281
- response = {
1282
- ...parsedBody.Error,
1283
- name: `${errorCode}`,
1284
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
988
+ response = new SNSServiceException_1.SNSServiceException({
989
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1285
990
  $fault: "client",
1286
991
  $metadata: deserializeMetadata(output),
1287
- };
992
+ });
993
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1288
994
  }
1289
- const message = response.message || response.Message || errorCode;
1290
- response.message = message;
1291
- delete response.Message;
1292
- return Promise.reject(Object.assign(new Error(message), response));
1293
995
  };
1294
996
  const deserializeAws_queryDeleteTopicCommand = async (output, context) => {
1295
997
  if (output.statusCode >= 300) {
@@ -1313,75 +1015,34 @@ const deserializeAws_queryDeleteTopicCommandError = async (output, context) => {
1313
1015
  switch (errorCode) {
1314
1016
  case "AuthorizationErrorException":
1315
1017
  case "com.amazonaws.sns#AuthorizationErrorException":
1316
- response = {
1317
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1318
- name: errorCode,
1319
- $metadata: deserializeMetadata(output),
1320
- };
1321
- break;
1018
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1322
1019
  case "ConcurrentAccessException":
1323
1020
  case "com.amazonaws.sns#ConcurrentAccessException":
1324
- response = {
1325
- ...(await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context)),
1326
- name: errorCode,
1327
- $metadata: deserializeMetadata(output),
1328
- };
1329
- break;
1021
+ throw await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context);
1330
1022
  case "InternalErrorException":
1331
1023
  case "com.amazonaws.sns#InternalErrorException":
1332
- response = {
1333
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1334
- name: errorCode,
1335
- $metadata: deserializeMetadata(output),
1336
- };
1337
- break;
1024
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1338
1025
  case "InvalidParameterException":
1339
1026
  case "com.amazonaws.sns#InvalidParameterException":
1340
- response = {
1341
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1342
- name: errorCode,
1343
- $metadata: deserializeMetadata(output),
1344
- };
1345
- break;
1027
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1346
1028
  case "NotFoundException":
1347
1029
  case "com.amazonaws.sns#NotFoundException":
1348
- response = {
1349
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1350
- name: errorCode,
1351
- $metadata: deserializeMetadata(output),
1352
- };
1353
- break;
1030
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1354
1031
  case "StaleTagException":
1355
1032
  case "com.amazonaws.sns#StaleTagException":
1356
- response = {
1357
- ...(await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context)),
1358
- name: errorCode,
1359
- $metadata: deserializeMetadata(output),
1360
- };
1361
- break;
1033
+ throw await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context);
1362
1034
  case "TagPolicyException":
1363
1035
  case "com.amazonaws.sns#TagPolicyException":
1364
- response = {
1365
- ...(await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context)),
1366
- name: errorCode,
1367
- $metadata: deserializeMetadata(output),
1368
- };
1369
- break;
1036
+ throw await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context);
1370
1037
  default:
1371
1038
  const parsedBody = parsedOutput.body;
1372
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1373
- response = {
1374
- ...parsedBody.Error,
1375
- name: `${errorCode}`,
1376
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1039
+ response = new SNSServiceException_1.SNSServiceException({
1040
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1377
1041
  $fault: "client",
1378
1042
  $metadata: deserializeMetadata(output),
1379
- };
1043
+ });
1044
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1380
1045
  }
1381
- const message = response.message || response.Message || errorCode;
1382
- response.message = message;
1383
- delete response.Message;
1384
- return Promise.reject(Object.assign(new Error(message), response));
1385
1046
  };
1386
1047
  const deserializeAws_queryGetEndpointAttributesCommand = async (output, context) => {
1387
1048
  if (output.statusCode >= 300) {
@@ -1408,51 +1069,25 @@ const deserializeAws_queryGetEndpointAttributesCommandError = async (output, con
1408
1069
  switch (errorCode) {
1409
1070
  case "AuthorizationErrorException":
1410
1071
  case "com.amazonaws.sns#AuthorizationErrorException":
1411
- response = {
1412
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1413
- name: errorCode,
1414
- $metadata: deserializeMetadata(output),
1415
- };
1416
- break;
1072
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1417
1073
  case "InternalErrorException":
1418
1074
  case "com.amazonaws.sns#InternalErrorException":
1419
- response = {
1420
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1421
- name: errorCode,
1422
- $metadata: deserializeMetadata(output),
1423
- };
1424
- break;
1075
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1425
1076
  case "InvalidParameterException":
1426
1077
  case "com.amazonaws.sns#InvalidParameterException":
1427
- response = {
1428
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1429
- name: errorCode,
1430
- $metadata: deserializeMetadata(output),
1431
- };
1432
- break;
1078
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1433
1079
  case "NotFoundException":
1434
1080
  case "com.amazonaws.sns#NotFoundException":
1435
- response = {
1436
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1437
- name: errorCode,
1438
- $metadata: deserializeMetadata(output),
1439
- };
1440
- break;
1081
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1441
1082
  default:
1442
1083
  const parsedBody = parsedOutput.body;
1443
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1444
- response = {
1445
- ...parsedBody.Error,
1446
- name: `${errorCode}`,
1447
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1084
+ response = new SNSServiceException_1.SNSServiceException({
1085
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1448
1086
  $fault: "client",
1449
1087
  $metadata: deserializeMetadata(output),
1450
- };
1088
+ });
1089
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1451
1090
  }
1452
- const message = response.message || response.Message || errorCode;
1453
- response.message = message;
1454
- delete response.Message;
1455
- return Promise.reject(Object.assign(new Error(message), response));
1456
1091
  };
1457
1092
  const deserializeAws_queryGetPlatformApplicationAttributesCommand = async (output, context) => {
1458
1093
  if (output.statusCode >= 300) {
@@ -1479,51 +1114,25 @@ const deserializeAws_queryGetPlatformApplicationAttributesCommandError = async (
1479
1114
  switch (errorCode) {
1480
1115
  case "AuthorizationErrorException":
1481
1116
  case "com.amazonaws.sns#AuthorizationErrorException":
1482
- response = {
1483
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1484
- name: errorCode,
1485
- $metadata: deserializeMetadata(output),
1486
- };
1487
- break;
1117
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1488
1118
  case "InternalErrorException":
1489
1119
  case "com.amazonaws.sns#InternalErrorException":
1490
- response = {
1491
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1492
- name: errorCode,
1493
- $metadata: deserializeMetadata(output),
1494
- };
1495
- break;
1120
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1496
1121
  case "InvalidParameterException":
1497
1122
  case "com.amazonaws.sns#InvalidParameterException":
1498
- response = {
1499
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1500
- name: errorCode,
1501
- $metadata: deserializeMetadata(output),
1502
- };
1503
- break;
1123
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1504
1124
  case "NotFoundException":
1505
1125
  case "com.amazonaws.sns#NotFoundException":
1506
- response = {
1507
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1508
- name: errorCode,
1509
- $metadata: deserializeMetadata(output),
1510
- };
1511
- break;
1126
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1512
1127
  default:
1513
1128
  const parsedBody = parsedOutput.body;
1514
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1515
- response = {
1516
- ...parsedBody.Error,
1517
- name: `${errorCode}`,
1518
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1129
+ response = new SNSServiceException_1.SNSServiceException({
1130
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1519
1131
  $fault: "client",
1520
1132
  $metadata: deserializeMetadata(output),
1521
- };
1133
+ });
1134
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1522
1135
  }
1523
- const message = response.message || response.Message || errorCode;
1524
- response.message = message;
1525
- delete response.Message;
1526
- return Promise.reject(Object.assign(new Error(message), response));
1527
1136
  };
1528
1137
  const deserializeAws_queryGetSMSAttributesCommand = async (output, context) => {
1529
1138
  if (output.statusCode >= 300) {
@@ -1550,51 +1159,25 @@ const deserializeAws_queryGetSMSAttributesCommandError = async (output, context)
1550
1159
  switch (errorCode) {
1551
1160
  case "AuthorizationErrorException":
1552
1161
  case "com.amazonaws.sns#AuthorizationErrorException":
1553
- response = {
1554
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1555
- name: errorCode,
1556
- $metadata: deserializeMetadata(output),
1557
- };
1558
- break;
1162
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1559
1163
  case "InternalErrorException":
1560
1164
  case "com.amazonaws.sns#InternalErrorException":
1561
- response = {
1562
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1563
- name: errorCode,
1564
- $metadata: deserializeMetadata(output),
1565
- };
1566
- break;
1165
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1567
1166
  case "InvalidParameterException":
1568
1167
  case "com.amazonaws.sns#InvalidParameterException":
1569
- response = {
1570
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1571
- name: errorCode,
1572
- $metadata: deserializeMetadata(output),
1573
- };
1574
- break;
1168
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1575
1169
  case "ThrottledException":
1576
1170
  case "com.amazonaws.sns#ThrottledException":
1577
- response = {
1578
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
1579
- name: errorCode,
1580
- $metadata: deserializeMetadata(output),
1581
- };
1582
- break;
1171
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
1583
1172
  default:
1584
1173
  const parsedBody = parsedOutput.body;
1585
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1586
- response = {
1587
- ...parsedBody.Error,
1588
- name: `${errorCode}`,
1589
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1174
+ response = new SNSServiceException_1.SNSServiceException({
1175
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1590
1176
  $fault: "client",
1591
1177
  $metadata: deserializeMetadata(output),
1592
- };
1178
+ });
1179
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1593
1180
  }
1594
- const message = response.message || response.Message || errorCode;
1595
- response.message = message;
1596
- delete response.Message;
1597
- return Promise.reject(Object.assign(new Error(message), response));
1598
1181
  };
1599
1182
  const deserializeAws_queryGetSMSSandboxAccountStatusCommand = async (output, context) => {
1600
1183
  if (output.statusCode >= 300) {
@@ -1621,43 +1204,22 @@ const deserializeAws_queryGetSMSSandboxAccountStatusCommandError = async (output
1621
1204
  switch (errorCode) {
1622
1205
  case "AuthorizationErrorException":
1623
1206
  case "com.amazonaws.sns#AuthorizationErrorException":
1624
- response = {
1625
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1626
- name: errorCode,
1627
- $metadata: deserializeMetadata(output),
1628
- };
1629
- break;
1207
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1630
1208
  case "InternalErrorException":
1631
1209
  case "com.amazonaws.sns#InternalErrorException":
1632
- response = {
1633
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1634
- name: errorCode,
1635
- $metadata: deserializeMetadata(output),
1636
- };
1637
- break;
1210
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1638
1211
  case "ThrottledException":
1639
1212
  case "com.amazonaws.sns#ThrottledException":
1640
- response = {
1641
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
1642
- name: errorCode,
1643
- $metadata: deserializeMetadata(output),
1644
- };
1645
- break;
1213
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
1646
1214
  default:
1647
1215
  const parsedBody = parsedOutput.body;
1648
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1649
- response = {
1650
- ...parsedBody.Error,
1651
- name: `${errorCode}`,
1652
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1216
+ response = new SNSServiceException_1.SNSServiceException({
1217
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1653
1218
  $fault: "client",
1654
1219
  $metadata: deserializeMetadata(output),
1655
- };
1220
+ });
1221
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1656
1222
  }
1657
- const message = response.message || response.Message || errorCode;
1658
- response.message = message;
1659
- delete response.Message;
1660
- return Promise.reject(Object.assign(new Error(message), response));
1661
1223
  };
1662
1224
  const deserializeAws_queryGetSubscriptionAttributesCommand = async (output, context) => {
1663
1225
  if (output.statusCode >= 300) {
@@ -1684,51 +1246,25 @@ const deserializeAws_queryGetSubscriptionAttributesCommandError = async (output,
1684
1246
  switch (errorCode) {
1685
1247
  case "AuthorizationErrorException":
1686
1248
  case "com.amazonaws.sns#AuthorizationErrorException":
1687
- response = {
1688
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1689
- name: errorCode,
1690
- $metadata: deserializeMetadata(output),
1691
- };
1692
- break;
1249
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1693
1250
  case "InternalErrorException":
1694
1251
  case "com.amazonaws.sns#InternalErrorException":
1695
- response = {
1696
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1697
- name: errorCode,
1698
- $metadata: deserializeMetadata(output),
1699
- };
1700
- break;
1252
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1701
1253
  case "InvalidParameterException":
1702
1254
  case "com.amazonaws.sns#InvalidParameterException":
1703
- response = {
1704
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1705
- name: errorCode,
1706
- $metadata: deserializeMetadata(output),
1707
- };
1708
- break;
1255
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1709
1256
  case "NotFoundException":
1710
1257
  case "com.amazonaws.sns#NotFoundException":
1711
- response = {
1712
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1713
- name: errorCode,
1714
- $metadata: deserializeMetadata(output),
1715
- };
1716
- break;
1258
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1717
1259
  default:
1718
1260
  const parsedBody = parsedOutput.body;
1719
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1720
- response = {
1721
- ...parsedBody.Error,
1722
- name: `${errorCode}`,
1723
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1261
+ response = new SNSServiceException_1.SNSServiceException({
1262
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1724
1263
  $fault: "client",
1725
1264
  $metadata: deserializeMetadata(output),
1726
- };
1265
+ });
1266
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1727
1267
  }
1728
- const message = response.message || response.Message || errorCode;
1729
- response.message = message;
1730
- delete response.Message;
1731
- return Promise.reject(Object.assign(new Error(message), response));
1732
1268
  };
1733
1269
  const deserializeAws_queryGetTopicAttributesCommand = async (output, context) => {
1734
1270
  if (output.statusCode >= 300) {
@@ -1755,59 +1291,28 @@ const deserializeAws_queryGetTopicAttributesCommandError = async (output, contex
1755
1291
  switch (errorCode) {
1756
1292
  case "AuthorizationErrorException":
1757
1293
  case "com.amazonaws.sns#AuthorizationErrorException":
1758
- response = {
1759
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1760
- name: errorCode,
1761
- $metadata: deserializeMetadata(output),
1762
- };
1763
- break;
1294
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1764
1295
  case "InternalErrorException":
1765
1296
  case "com.amazonaws.sns#InternalErrorException":
1766
- response = {
1767
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1768
- name: errorCode,
1769
- $metadata: deserializeMetadata(output),
1770
- };
1771
- break;
1297
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1772
1298
  case "InvalidParameterException":
1773
1299
  case "com.amazonaws.sns#InvalidParameterException":
1774
- response = {
1775
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1776
- name: errorCode,
1777
- $metadata: deserializeMetadata(output),
1778
- };
1779
- break;
1300
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1780
1301
  case "InvalidSecurityException":
1781
1302
  case "com.amazonaws.sns#InvalidSecurityException":
1782
- response = {
1783
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
1784
- name: errorCode,
1785
- $metadata: deserializeMetadata(output),
1786
- };
1787
- break;
1303
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
1788
1304
  case "NotFoundException":
1789
1305
  case "com.amazonaws.sns#NotFoundException":
1790
- response = {
1791
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1792
- name: errorCode,
1793
- $metadata: deserializeMetadata(output),
1794
- };
1795
- break;
1306
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1796
1307
  default:
1797
1308
  const parsedBody = parsedOutput.body;
1798
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1799
- response = {
1800
- ...parsedBody.Error,
1801
- name: `${errorCode}`,
1802
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1309
+ response = new SNSServiceException_1.SNSServiceException({
1310
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1803
1311
  $fault: "client",
1804
1312
  $metadata: deserializeMetadata(output),
1805
- };
1313
+ });
1314
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1806
1315
  }
1807
- const message = response.message || response.Message || errorCode;
1808
- response.message = message;
1809
- delete response.Message;
1810
- return Promise.reject(Object.assign(new Error(message), response));
1811
1316
  };
1812
1317
  const deserializeAws_queryListEndpointsByPlatformApplicationCommand = async (output, context) => {
1813
1318
  if (output.statusCode >= 300) {
@@ -1834,51 +1339,25 @@ const deserializeAws_queryListEndpointsByPlatformApplicationCommandError = async
1834
1339
  switch (errorCode) {
1835
1340
  case "AuthorizationErrorException":
1836
1341
  case "com.amazonaws.sns#AuthorizationErrorException":
1837
- response = {
1838
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1839
- name: errorCode,
1840
- $metadata: deserializeMetadata(output),
1841
- };
1842
- break;
1342
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1843
1343
  case "InternalErrorException":
1844
1344
  case "com.amazonaws.sns#InternalErrorException":
1845
- response = {
1846
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1847
- name: errorCode,
1848
- $metadata: deserializeMetadata(output),
1849
- };
1850
- break;
1345
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1851
1346
  case "InvalidParameterException":
1852
1347
  case "com.amazonaws.sns#InvalidParameterException":
1853
- response = {
1854
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1855
- name: errorCode,
1856
- $metadata: deserializeMetadata(output),
1857
- };
1858
- break;
1348
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1859
1349
  case "NotFoundException":
1860
1350
  case "com.amazonaws.sns#NotFoundException":
1861
- response = {
1862
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
1863
- name: errorCode,
1864
- $metadata: deserializeMetadata(output),
1865
- };
1866
- break;
1351
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
1867
1352
  default:
1868
1353
  const parsedBody = parsedOutput.body;
1869
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1870
- response = {
1871
- ...parsedBody.Error,
1872
- name: `${errorCode}`,
1873
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1354
+ response = new SNSServiceException_1.SNSServiceException({
1355
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1874
1356
  $fault: "client",
1875
1357
  $metadata: deserializeMetadata(output),
1876
- };
1358
+ });
1359
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1877
1360
  }
1878
- const message = response.message || response.Message || errorCode;
1879
- response.message = message;
1880
- delete response.Message;
1881
- return Promise.reject(Object.assign(new Error(message), response));
1882
1361
  };
1883
1362
  const deserializeAws_queryListOriginationNumbersCommand = async (output, context) => {
1884
1363
  if (output.statusCode >= 300) {
@@ -1905,59 +1384,28 @@ const deserializeAws_queryListOriginationNumbersCommandError = async (output, co
1905
1384
  switch (errorCode) {
1906
1385
  case "AuthorizationErrorException":
1907
1386
  case "com.amazonaws.sns#AuthorizationErrorException":
1908
- response = {
1909
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1910
- name: errorCode,
1911
- $metadata: deserializeMetadata(output),
1912
- };
1913
- break;
1387
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1914
1388
  case "InternalErrorException":
1915
1389
  case "com.amazonaws.sns#InternalErrorException":
1916
- response = {
1917
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1918
- name: errorCode,
1919
- $metadata: deserializeMetadata(output),
1920
- };
1921
- break;
1390
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
1922
1391
  case "InvalidParameterException":
1923
1392
  case "com.amazonaws.sns#InvalidParameterException":
1924
- response = {
1925
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
1926
- name: errorCode,
1927
- $metadata: deserializeMetadata(output),
1928
- };
1929
- break;
1393
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
1930
1394
  case "ThrottledException":
1931
1395
  case "com.amazonaws.sns#ThrottledException":
1932
- response = {
1933
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
1934
- name: errorCode,
1935
- $metadata: deserializeMetadata(output),
1936
- };
1937
- break;
1396
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
1938
1397
  case "ValidationException":
1939
1398
  case "com.amazonaws.sns#ValidationException":
1940
- response = {
1941
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
1942
- name: errorCode,
1943
- $metadata: deserializeMetadata(output),
1944
- };
1945
- break;
1399
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
1946
1400
  default:
1947
1401
  const parsedBody = parsedOutput.body;
1948
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1949
- response = {
1950
- ...parsedBody.Error,
1951
- name: `${errorCode}`,
1952
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1402
+ response = new SNSServiceException_1.SNSServiceException({
1403
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1953
1404
  $fault: "client",
1954
1405
  $metadata: deserializeMetadata(output),
1955
- };
1406
+ });
1407
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1956
1408
  }
1957
- const message = response.message || response.Message || errorCode;
1958
- response.message = message;
1959
- delete response.Message;
1960
- return Promise.reject(Object.assign(new Error(message), response));
1961
1409
  };
1962
1410
  const deserializeAws_queryListPhoneNumbersOptedOutCommand = async (output, context) => {
1963
1411
  if (output.statusCode >= 300) {
@@ -1984,51 +1432,25 @@ const deserializeAws_queryListPhoneNumbersOptedOutCommandError = async (output,
1984
1432
  switch (errorCode) {
1985
1433
  case "AuthorizationErrorException":
1986
1434
  case "com.amazonaws.sns#AuthorizationErrorException":
1987
- response = {
1988
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
1989
- name: errorCode,
1990
- $metadata: deserializeMetadata(output),
1991
- };
1992
- break;
1435
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
1993
1436
  case "InternalErrorException":
1994
1437
  case "com.amazonaws.sns#InternalErrorException":
1995
- response = {
1996
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
1997
- name: errorCode,
1998
- $metadata: deserializeMetadata(output),
1999
- };
2000
- break;
1438
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2001
1439
  case "InvalidParameterException":
2002
1440
  case "com.amazonaws.sns#InvalidParameterException":
2003
- response = {
2004
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2005
- name: errorCode,
2006
- $metadata: deserializeMetadata(output),
2007
- };
2008
- break;
1441
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2009
1442
  case "ThrottledException":
2010
1443
  case "com.amazonaws.sns#ThrottledException":
2011
- response = {
2012
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
2013
- name: errorCode,
2014
- $metadata: deserializeMetadata(output),
2015
- };
2016
- break;
1444
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
2017
1445
  default:
2018
1446
  const parsedBody = parsedOutput.body;
2019
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2020
- response = {
2021
- ...parsedBody.Error,
2022
- name: `${errorCode}`,
2023
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1447
+ response = new SNSServiceException_1.SNSServiceException({
1448
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2024
1449
  $fault: "client",
2025
1450
  $metadata: deserializeMetadata(output),
2026
- };
1451
+ });
1452
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2027
1453
  }
2028
- const message = response.message || response.Message || errorCode;
2029
- response.message = message;
2030
- delete response.Message;
2031
- return Promise.reject(Object.assign(new Error(message), response));
2032
1454
  };
2033
1455
  const deserializeAws_queryListPlatformApplicationsCommand = async (output, context) => {
2034
1456
  if (output.statusCode >= 300) {
@@ -2055,43 +1477,22 @@ const deserializeAws_queryListPlatformApplicationsCommandError = async (output,
2055
1477
  switch (errorCode) {
2056
1478
  case "AuthorizationErrorException":
2057
1479
  case "com.amazonaws.sns#AuthorizationErrorException":
2058
- response = {
2059
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2060
- name: errorCode,
2061
- $metadata: deserializeMetadata(output),
2062
- };
2063
- break;
1480
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2064
1481
  case "InternalErrorException":
2065
1482
  case "com.amazonaws.sns#InternalErrorException":
2066
- response = {
2067
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2068
- name: errorCode,
2069
- $metadata: deserializeMetadata(output),
2070
- };
2071
- break;
1483
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2072
1484
  case "InvalidParameterException":
2073
1485
  case "com.amazonaws.sns#InvalidParameterException":
2074
- response = {
2075
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2076
- name: errorCode,
2077
- $metadata: deserializeMetadata(output),
2078
- };
2079
- break;
1486
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2080
1487
  default:
2081
1488
  const parsedBody = parsedOutput.body;
2082
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2083
- response = {
2084
- ...parsedBody.Error,
2085
- name: `${errorCode}`,
2086
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1489
+ response = new SNSServiceException_1.SNSServiceException({
1490
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2087
1491
  $fault: "client",
2088
1492
  $metadata: deserializeMetadata(output),
2089
- };
1493
+ });
1494
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2090
1495
  }
2091
- const message = response.message || response.Message || errorCode;
2092
- response.message = message;
2093
- delete response.Message;
2094
- return Promise.reject(Object.assign(new Error(message), response));
2095
1496
  };
2096
1497
  const deserializeAws_queryListSMSSandboxPhoneNumbersCommand = async (output, context) => {
2097
1498
  if (output.statusCode >= 300) {
@@ -2118,59 +1519,28 @@ const deserializeAws_queryListSMSSandboxPhoneNumbersCommandError = async (output
2118
1519
  switch (errorCode) {
2119
1520
  case "AuthorizationErrorException":
2120
1521
  case "com.amazonaws.sns#AuthorizationErrorException":
2121
- response = {
2122
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2123
- name: errorCode,
2124
- $metadata: deserializeMetadata(output),
2125
- };
2126
- break;
1522
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2127
1523
  case "InternalErrorException":
2128
1524
  case "com.amazonaws.sns#InternalErrorException":
2129
- response = {
2130
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2131
- name: errorCode,
2132
- $metadata: deserializeMetadata(output),
2133
- };
2134
- break;
1525
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2135
1526
  case "InvalidParameterException":
2136
1527
  case "com.amazonaws.sns#InvalidParameterException":
2137
- response = {
2138
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2139
- name: errorCode,
2140
- $metadata: deserializeMetadata(output),
2141
- };
2142
- break;
1528
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2143
1529
  case "ResourceNotFoundException":
2144
1530
  case "com.amazonaws.sns#ResourceNotFoundException":
2145
- response = {
2146
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
2147
- name: errorCode,
2148
- $metadata: deserializeMetadata(output),
2149
- };
2150
- break;
1531
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2151
1532
  case "ThrottledException":
2152
1533
  case "com.amazonaws.sns#ThrottledException":
2153
- response = {
2154
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
2155
- name: errorCode,
2156
- $metadata: deserializeMetadata(output),
2157
- };
2158
- break;
1534
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
2159
1535
  default:
2160
1536
  const parsedBody = parsedOutput.body;
2161
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2162
- response = {
2163
- ...parsedBody.Error,
2164
- name: `${errorCode}`,
2165
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1537
+ response = new SNSServiceException_1.SNSServiceException({
1538
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2166
1539
  $fault: "client",
2167
1540
  $metadata: deserializeMetadata(output),
2168
- };
1541
+ });
1542
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2169
1543
  }
2170
- const message = response.message || response.Message || errorCode;
2171
- response.message = message;
2172
- delete response.Message;
2173
- return Promise.reject(Object.assign(new Error(message), response));
2174
1544
  };
2175
1545
  const deserializeAws_queryListSubscriptionsCommand = async (output, context) => {
2176
1546
  if (output.statusCode >= 300) {
@@ -2197,43 +1567,22 @@ const deserializeAws_queryListSubscriptionsCommandError = async (output, context
2197
1567
  switch (errorCode) {
2198
1568
  case "AuthorizationErrorException":
2199
1569
  case "com.amazonaws.sns#AuthorizationErrorException":
2200
- response = {
2201
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2202
- name: errorCode,
2203
- $metadata: deserializeMetadata(output),
2204
- };
2205
- break;
1570
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2206
1571
  case "InternalErrorException":
2207
1572
  case "com.amazonaws.sns#InternalErrorException":
2208
- response = {
2209
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2210
- name: errorCode,
2211
- $metadata: deserializeMetadata(output),
2212
- };
2213
- break;
1573
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2214
1574
  case "InvalidParameterException":
2215
1575
  case "com.amazonaws.sns#InvalidParameterException":
2216
- response = {
2217
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2218
- name: errorCode,
2219
- $metadata: deserializeMetadata(output),
2220
- };
2221
- break;
1576
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2222
1577
  default:
2223
1578
  const parsedBody = parsedOutput.body;
2224
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2225
- response = {
2226
- ...parsedBody.Error,
2227
- name: `${errorCode}`,
2228
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1579
+ response = new SNSServiceException_1.SNSServiceException({
1580
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2229
1581
  $fault: "client",
2230
1582
  $metadata: deserializeMetadata(output),
2231
- };
1583
+ });
1584
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2232
1585
  }
2233
- const message = response.message || response.Message || errorCode;
2234
- response.message = message;
2235
- delete response.Message;
2236
- return Promise.reject(Object.assign(new Error(message), response));
2237
1586
  };
2238
1587
  const deserializeAws_queryListSubscriptionsByTopicCommand = async (output, context) => {
2239
1588
  if (output.statusCode >= 300) {
@@ -2260,51 +1609,25 @@ const deserializeAws_queryListSubscriptionsByTopicCommandError = async (output,
2260
1609
  switch (errorCode) {
2261
1610
  case "AuthorizationErrorException":
2262
1611
  case "com.amazonaws.sns#AuthorizationErrorException":
2263
- response = {
2264
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2265
- name: errorCode,
2266
- $metadata: deserializeMetadata(output),
2267
- };
2268
- break;
1612
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2269
1613
  case "InternalErrorException":
2270
1614
  case "com.amazonaws.sns#InternalErrorException":
2271
- response = {
2272
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2273
- name: errorCode,
2274
- $metadata: deserializeMetadata(output),
2275
- };
2276
- break;
1615
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2277
1616
  case "InvalidParameterException":
2278
1617
  case "com.amazonaws.sns#InvalidParameterException":
2279
- response = {
2280
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2281
- name: errorCode,
2282
- $metadata: deserializeMetadata(output),
2283
- };
2284
- break;
1618
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2285
1619
  case "NotFoundException":
2286
1620
  case "com.amazonaws.sns#NotFoundException":
2287
- response = {
2288
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
2289
- name: errorCode,
2290
- $metadata: deserializeMetadata(output),
2291
- };
2292
- break;
1621
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
2293
1622
  default:
2294
1623
  const parsedBody = parsedOutput.body;
2295
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2296
- response = {
2297
- ...parsedBody.Error,
2298
- name: `${errorCode}`,
2299
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1624
+ response = new SNSServiceException_1.SNSServiceException({
1625
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2300
1626
  $fault: "client",
2301
1627
  $metadata: deserializeMetadata(output),
2302
- };
1628
+ });
1629
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2303
1630
  }
2304
- const message = response.message || response.Message || errorCode;
2305
- response.message = message;
2306
- delete response.Message;
2307
- return Promise.reject(Object.assign(new Error(message), response));
2308
1631
  };
2309
1632
  const deserializeAws_queryListTagsForResourceCommand = async (output, context) => {
2310
1633
  if (output.statusCode >= 300) {
@@ -2331,59 +1654,28 @@ const deserializeAws_queryListTagsForResourceCommandError = async (output, conte
2331
1654
  switch (errorCode) {
2332
1655
  case "AuthorizationErrorException":
2333
1656
  case "com.amazonaws.sns#AuthorizationErrorException":
2334
- response = {
2335
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2336
- name: errorCode,
2337
- $metadata: deserializeMetadata(output),
2338
- };
2339
- break;
1657
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2340
1658
  case "ConcurrentAccessException":
2341
1659
  case "com.amazonaws.sns#ConcurrentAccessException":
2342
- response = {
2343
- ...(await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context)),
2344
- name: errorCode,
2345
- $metadata: deserializeMetadata(output),
2346
- };
2347
- break;
1660
+ throw await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context);
2348
1661
  case "InvalidParameterException":
2349
1662
  case "com.amazonaws.sns#InvalidParameterException":
2350
- response = {
2351
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2352
- name: errorCode,
2353
- $metadata: deserializeMetadata(output),
2354
- };
2355
- break;
1663
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2356
1664
  case "ResourceNotFoundException":
2357
1665
  case "com.amazonaws.sns#ResourceNotFoundException":
2358
- response = {
2359
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
2360
- name: errorCode,
2361
- $metadata: deserializeMetadata(output),
2362
- };
2363
- break;
1666
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2364
1667
  case "TagPolicyException":
2365
1668
  case "com.amazonaws.sns#TagPolicyException":
2366
- response = {
2367
- ...(await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context)),
2368
- name: errorCode,
2369
- $metadata: deserializeMetadata(output),
2370
- };
2371
- break;
1669
+ throw await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context);
2372
1670
  default:
2373
1671
  const parsedBody = parsedOutput.body;
2374
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2375
- response = {
2376
- ...parsedBody.Error,
2377
- name: `${errorCode}`,
2378
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1672
+ response = new SNSServiceException_1.SNSServiceException({
1673
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2379
1674
  $fault: "client",
2380
1675
  $metadata: deserializeMetadata(output),
2381
- };
1676
+ });
1677
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2382
1678
  }
2383
- const message = response.message || response.Message || errorCode;
2384
- response.message = message;
2385
- delete response.Message;
2386
- return Promise.reject(Object.assign(new Error(message), response));
2387
1679
  };
2388
1680
  const deserializeAws_queryListTopicsCommand = async (output, context) => {
2389
1681
  if (output.statusCode >= 300) {
@@ -2410,43 +1702,22 @@ const deserializeAws_queryListTopicsCommandError = async (output, context) => {
2410
1702
  switch (errorCode) {
2411
1703
  case "AuthorizationErrorException":
2412
1704
  case "com.amazonaws.sns#AuthorizationErrorException":
2413
- response = {
2414
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2415
- name: errorCode,
2416
- $metadata: deserializeMetadata(output),
2417
- };
2418
- break;
1705
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2419
1706
  case "InternalErrorException":
2420
1707
  case "com.amazonaws.sns#InternalErrorException":
2421
- response = {
2422
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2423
- name: errorCode,
2424
- $metadata: deserializeMetadata(output),
2425
- };
2426
- break;
1708
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2427
1709
  case "InvalidParameterException":
2428
1710
  case "com.amazonaws.sns#InvalidParameterException":
2429
- response = {
2430
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2431
- name: errorCode,
2432
- $metadata: deserializeMetadata(output),
2433
- };
2434
- break;
1711
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2435
1712
  default:
2436
1713
  const parsedBody = parsedOutput.body;
2437
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2438
- response = {
2439
- ...parsedBody.Error,
2440
- name: `${errorCode}`,
2441
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1714
+ response = new SNSServiceException_1.SNSServiceException({
1715
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2442
1716
  $fault: "client",
2443
1717
  $metadata: deserializeMetadata(output),
2444
- };
1718
+ });
1719
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2445
1720
  }
2446
- const message = response.message || response.Message || errorCode;
2447
- response.message = message;
2448
- delete response.Message;
2449
- return Promise.reject(Object.assign(new Error(message), response));
2450
1721
  };
2451
1722
  const deserializeAws_queryOptInPhoneNumberCommand = async (output, context) => {
2452
1723
  if (output.statusCode >= 300) {
@@ -2473,51 +1744,25 @@ const deserializeAws_queryOptInPhoneNumberCommandError = async (output, context)
2473
1744
  switch (errorCode) {
2474
1745
  case "AuthorizationErrorException":
2475
1746
  case "com.amazonaws.sns#AuthorizationErrorException":
2476
- response = {
2477
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2478
- name: errorCode,
2479
- $metadata: deserializeMetadata(output),
2480
- };
2481
- break;
1747
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2482
1748
  case "InternalErrorException":
2483
1749
  case "com.amazonaws.sns#InternalErrorException":
2484
- response = {
2485
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2486
- name: errorCode,
2487
- $metadata: deserializeMetadata(output),
2488
- };
2489
- break;
1750
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2490
1751
  case "InvalidParameterException":
2491
1752
  case "com.amazonaws.sns#InvalidParameterException":
2492
- response = {
2493
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2494
- name: errorCode,
2495
- $metadata: deserializeMetadata(output),
2496
- };
2497
- break;
1753
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2498
1754
  case "ThrottledException":
2499
1755
  case "com.amazonaws.sns#ThrottledException":
2500
- response = {
2501
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
2502
- name: errorCode,
2503
- $metadata: deserializeMetadata(output),
2504
- };
2505
- break;
1756
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
2506
1757
  default:
2507
1758
  const parsedBody = parsedOutput.body;
2508
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2509
- response = {
2510
- ...parsedBody.Error,
2511
- name: `${errorCode}`,
2512
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1759
+ response = new SNSServiceException_1.SNSServiceException({
1760
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2513
1761
  $fault: "client",
2514
1762
  $metadata: deserializeMetadata(output),
2515
- };
1763
+ });
1764
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2516
1765
  }
2517
- const message = response.message || response.Message || errorCode;
2518
- response.message = message;
2519
- delete response.Message;
2520
- return Promise.reject(Object.assign(new Error(message), response));
2521
1766
  };
2522
1767
  const deserializeAws_queryPublishCommand = async (output, context) => {
2523
1768
  if (output.statusCode >= 300) {
@@ -2544,131 +1789,55 @@ const deserializeAws_queryPublishCommandError = async (output, context) => {
2544
1789
  switch (errorCode) {
2545
1790
  case "AuthorizationErrorException":
2546
1791
  case "com.amazonaws.sns#AuthorizationErrorException":
2547
- response = {
2548
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2549
- name: errorCode,
2550
- $metadata: deserializeMetadata(output),
2551
- };
2552
- break;
1792
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2553
1793
  case "EndpointDisabledException":
2554
1794
  case "com.amazonaws.sns#EndpointDisabledException":
2555
- response = {
2556
- ...(await deserializeAws_queryEndpointDisabledExceptionResponse(parsedOutput, context)),
2557
- name: errorCode,
2558
- $metadata: deserializeMetadata(output),
2559
- };
2560
- break;
1795
+ throw await deserializeAws_queryEndpointDisabledExceptionResponse(parsedOutput, context);
2561
1796
  case "InternalErrorException":
2562
1797
  case "com.amazonaws.sns#InternalErrorException":
2563
- response = {
2564
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2565
- name: errorCode,
2566
- $metadata: deserializeMetadata(output),
2567
- };
2568
- break;
1798
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2569
1799
  case "InvalidParameterException":
2570
1800
  case "com.amazonaws.sns#InvalidParameterException":
2571
- response = {
2572
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2573
- name: errorCode,
2574
- $metadata: deserializeMetadata(output),
2575
- };
2576
- break;
1801
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2577
1802
  case "InvalidParameterValueException":
2578
1803
  case "com.amazonaws.sns#InvalidParameterValueException":
2579
- response = {
2580
- ...(await deserializeAws_queryInvalidParameterValueExceptionResponse(parsedOutput, context)),
2581
- name: errorCode,
2582
- $metadata: deserializeMetadata(output),
2583
- };
2584
- break;
1804
+ throw await deserializeAws_queryInvalidParameterValueExceptionResponse(parsedOutput, context);
2585
1805
  case "InvalidSecurityException":
2586
1806
  case "com.amazonaws.sns#InvalidSecurityException":
2587
- response = {
2588
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
2589
- name: errorCode,
2590
- $metadata: deserializeMetadata(output),
2591
- };
2592
- break;
1807
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
2593
1808
  case "KMSAccessDeniedException":
2594
1809
  case "com.amazonaws.sns#KMSAccessDeniedException":
2595
- response = {
2596
- ...(await deserializeAws_queryKMSAccessDeniedExceptionResponse(parsedOutput, context)),
2597
- name: errorCode,
2598
- $metadata: deserializeMetadata(output),
2599
- };
2600
- break;
1810
+ throw await deserializeAws_queryKMSAccessDeniedExceptionResponse(parsedOutput, context);
2601
1811
  case "KMSDisabledException":
2602
1812
  case "com.amazonaws.sns#KMSDisabledException":
2603
- response = {
2604
- ...(await deserializeAws_queryKMSDisabledExceptionResponse(parsedOutput, context)),
2605
- name: errorCode,
2606
- $metadata: deserializeMetadata(output),
2607
- };
2608
- break;
1813
+ throw await deserializeAws_queryKMSDisabledExceptionResponse(parsedOutput, context);
2609
1814
  case "KMSInvalidStateException":
2610
1815
  case "com.amazonaws.sns#KMSInvalidStateException":
2611
- response = {
2612
- ...(await deserializeAws_queryKMSInvalidStateExceptionResponse(parsedOutput, context)),
2613
- name: errorCode,
2614
- $metadata: deserializeMetadata(output),
2615
- };
2616
- break;
1816
+ throw await deserializeAws_queryKMSInvalidStateExceptionResponse(parsedOutput, context);
2617
1817
  case "KMSNotFoundException":
2618
1818
  case "com.amazonaws.sns#KMSNotFoundException":
2619
- response = {
2620
- ...(await deserializeAws_queryKMSNotFoundExceptionResponse(parsedOutput, context)),
2621
- name: errorCode,
2622
- $metadata: deserializeMetadata(output),
2623
- };
2624
- break;
1819
+ throw await deserializeAws_queryKMSNotFoundExceptionResponse(parsedOutput, context);
2625
1820
  case "KMSOptInRequired":
2626
1821
  case "com.amazonaws.sns#KMSOptInRequired":
2627
- response = {
2628
- ...(await deserializeAws_queryKMSOptInRequiredResponse(parsedOutput, context)),
2629
- name: errorCode,
2630
- $metadata: deserializeMetadata(output),
2631
- };
2632
- break;
1822
+ throw await deserializeAws_queryKMSOptInRequiredResponse(parsedOutput, context);
2633
1823
  case "KMSThrottlingException":
2634
1824
  case "com.amazonaws.sns#KMSThrottlingException":
2635
- response = {
2636
- ...(await deserializeAws_queryKMSThrottlingExceptionResponse(parsedOutput, context)),
2637
- name: errorCode,
2638
- $metadata: deserializeMetadata(output),
2639
- };
2640
- break;
1825
+ throw await deserializeAws_queryKMSThrottlingExceptionResponse(parsedOutput, context);
2641
1826
  case "NotFoundException":
2642
1827
  case "com.amazonaws.sns#NotFoundException":
2643
- response = {
2644
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
2645
- name: errorCode,
2646
- $metadata: deserializeMetadata(output),
2647
- };
2648
- break;
1828
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
2649
1829
  case "PlatformApplicationDisabledException":
2650
1830
  case "com.amazonaws.sns#PlatformApplicationDisabledException":
2651
- response = {
2652
- ...(await deserializeAws_queryPlatformApplicationDisabledExceptionResponse(parsedOutput, context)),
2653
- name: errorCode,
2654
- $metadata: deserializeMetadata(output),
2655
- };
2656
- break;
1831
+ throw await deserializeAws_queryPlatformApplicationDisabledExceptionResponse(parsedOutput, context);
2657
1832
  default:
2658
1833
  const parsedBody = parsedOutput.body;
2659
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2660
- response = {
2661
- ...parsedBody.Error,
2662
- name: `${errorCode}`,
2663
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1834
+ response = new SNSServiceException_1.SNSServiceException({
1835
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2664
1836
  $fault: "client",
2665
1837
  $metadata: deserializeMetadata(output),
2666
- };
1838
+ });
1839
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2667
1840
  }
2668
- const message = response.message || response.Message || errorCode;
2669
- response.message = message;
2670
- delete response.Message;
2671
- return Promise.reject(Object.assign(new Error(message), response));
2672
1841
  };
2673
1842
  const deserializeAws_queryPublishBatchCommand = async (output, context) => {
2674
1843
  if (output.statusCode >= 300) {
@@ -2695,171 +1864,70 @@ const deserializeAws_queryPublishBatchCommandError = async (output, context) =>
2695
1864
  switch (errorCode) {
2696
1865
  case "AuthorizationErrorException":
2697
1866
  case "com.amazonaws.sns#AuthorizationErrorException":
2698
- response = {
2699
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2700
- name: errorCode,
2701
- $metadata: deserializeMetadata(output),
2702
- };
2703
- break;
1867
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2704
1868
  case "BatchEntryIdsNotDistinctException":
2705
1869
  case "com.amazonaws.sns#BatchEntryIdsNotDistinctException":
2706
- response = {
2707
- ...(await deserializeAws_queryBatchEntryIdsNotDistinctExceptionResponse(parsedOutput, context)),
2708
- name: errorCode,
2709
- $metadata: deserializeMetadata(output),
2710
- };
2711
- break;
1870
+ throw await deserializeAws_queryBatchEntryIdsNotDistinctExceptionResponse(parsedOutput, context);
2712
1871
  case "BatchRequestTooLongException":
2713
1872
  case "com.amazonaws.sns#BatchRequestTooLongException":
2714
- response = {
2715
- ...(await deserializeAws_queryBatchRequestTooLongExceptionResponse(parsedOutput, context)),
2716
- name: errorCode,
2717
- $metadata: deserializeMetadata(output),
2718
- };
2719
- break;
1873
+ throw await deserializeAws_queryBatchRequestTooLongExceptionResponse(parsedOutput, context);
2720
1874
  case "EmptyBatchRequestException":
2721
1875
  case "com.amazonaws.sns#EmptyBatchRequestException":
2722
- response = {
2723
- ...(await deserializeAws_queryEmptyBatchRequestExceptionResponse(parsedOutput, context)),
2724
- name: errorCode,
2725
- $metadata: deserializeMetadata(output),
2726
- };
2727
- break;
1876
+ throw await deserializeAws_queryEmptyBatchRequestExceptionResponse(parsedOutput, context);
2728
1877
  case "EndpointDisabledException":
2729
1878
  case "com.amazonaws.sns#EndpointDisabledException":
2730
- response = {
2731
- ...(await deserializeAws_queryEndpointDisabledExceptionResponse(parsedOutput, context)),
2732
- name: errorCode,
2733
- $metadata: deserializeMetadata(output),
2734
- };
2735
- break;
1879
+ throw await deserializeAws_queryEndpointDisabledExceptionResponse(parsedOutput, context);
2736
1880
  case "InternalErrorException":
2737
1881
  case "com.amazonaws.sns#InternalErrorException":
2738
- response = {
2739
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2740
- name: errorCode,
2741
- $metadata: deserializeMetadata(output),
2742
- };
2743
- break;
1882
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2744
1883
  case "InvalidBatchEntryIdException":
2745
1884
  case "com.amazonaws.sns#InvalidBatchEntryIdException":
2746
- response = {
2747
- ...(await deserializeAws_queryInvalidBatchEntryIdExceptionResponse(parsedOutput, context)),
2748
- name: errorCode,
2749
- $metadata: deserializeMetadata(output),
2750
- };
2751
- break;
1885
+ throw await deserializeAws_queryInvalidBatchEntryIdExceptionResponse(parsedOutput, context);
2752
1886
  case "InvalidParameterException":
2753
1887
  case "com.amazonaws.sns#InvalidParameterException":
2754
- response = {
2755
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2756
- name: errorCode,
2757
- $metadata: deserializeMetadata(output),
2758
- };
2759
- break;
1888
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2760
1889
  case "InvalidParameterValueException":
2761
1890
  case "com.amazonaws.sns#InvalidParameterValueException":
2762
- response = {
2763
- ...(await deserializeAws_queryInvalidParameterValueExceptionResponse(parsedOutput, context)),
2764
- name: errorCode,
2765
- $metadata: deserializeMetadata(output),
2766
- };
2767
- break;
1891
+ throw await deserializeAws_queryInvalidParameterValueExceptionResponse(parsedOutput, context);
2768
1892
  case "InvalidSecurityException":
2769
1893
  case "com.amazonaws.sns#InvalidSecurityException":
2770
- response = {
2771
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
2772
- name: errorCode,
2773
- $metadata: deserializeMetadata(output),
2774
- };
2775
- break;
1894
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
2776
1895
  case "KMSAccessDeniedException":
2777
1896
  case "com.amazonaws.sns#KMSAccessDeniedException":
2778
- response = {
2779
- ...(await deserializeAws_queryKMSAccessDeniedExceptionResponse(parsedOutput, context)),
2780
- name: errorCode,
2781
- $metadata: deserializeMetadata(output),
2782
- };
2783
- break;
1897
+ throw await deserializeAws_queryKMSAccessDeniedExceptionResponse(parsedOutput, context);
2784
1898
  case "KMSDisabledException":
2785
1899
  case "com.amazonaws.sns#KMSDisabledException":
2786
- response = {
2787
- ...(await deserializeAws_queryKMSDisabledExceptionResponse(parsedOutput, context)),
2788
- name: errorCode,
2789
- $metadata: deserializeMetadata(output),
2790
- };
2791
- break;
1900
+ throw await deserializeAws_queryKMSDisabledExceptionResponse(parsedOutput, context);
2792
1901
  case "KMSInvalidStateException":
2793
1902
  case "com.amazonaws.sns#KMSInvalidStateException":
2794
- response = {
2795
- ...(await deserializeAws_queryKMSInvalidStateExceptionResponse(parsedOutput, context)),
2796
- name: errorCode,
2797
- $metadata: deserializeMetadata(output),
2798
- };
2799
- break;
1903
+ throw await deserializeAws_queryKMSInvalidStateExceptionResponse(parsedOutput, context);
2800
1904
  case "KMSNotFoundException":
2801
1905
  case "com.amazonaws.sns#KMSNotFoundException":
2802
- response = {
2803
- ...(await deserializeAws_queryKMSNotFoundExceptionResponse(parsedOutput, context)),
2804
- name: errorCode,
2805
- $metadata: deserializeMetadata(output),
2806
- };
2807
- break;
1906
+ throw await deserializeAws_queryKMSNotFoundExceptionResponse(parsedOutput, context);
2808
1907
  case "KMSOptInRequired":
2809
1908
  case "com.amazonaws.sns#KMSOptInRequired":
2810
- response = {
2811
- ...(await deserializeAws_queryKMSOptInRequiredResponse(parsedOutput, context)),
2812
- name: errorCode,
2813
- $metadata: deserializeMetadata(output),
2814
- };
2815
- break;
1909
+ throw await deserializeAws_queryKMSOptInRequiredResponse(parsedOutput, context);
2816
1910
  case "KMSThrottlingException":
2817
1911
  case "com.amazonaws.sns#KMSThrottlingException":
2818
- response = {
2819
- ...(await deserializeAws_queryKMSThrottlingExceptionResponse(parsedOutput, context)),
2820
- name: errorCode,
2821
- $metadata: deserializeMetadata(output),
2822
- };
2823
- break;
1912
+ throw await deserializeAws_queryKMSThrottlingExceptionResponse(parsedOutput, context);
2824
1913
  case "NotFoundException":
2825
1914
  case "com.amazonaws.sns#NotFoundException":
2826
- response = {
2827
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
2828
- name: errorCode,
2829
- $metadata: deserializeMetadata(output),
2830
- };
2831
- break;
1915
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
2832
1916
  case "PlatformApplicationDisabledException":
2833
1917
  case "com.amazonaws.sns#PlatformApplicationDisabledException":
2834
- response = {
2835
- ...(await deserializeAws_queryPlatformApplicationDisabledExceptionResponse(parsedOutput, context)),
2836
- name: errorCode,
2837
- $metadata: deserializeMetadata(output),
2838
- };
2839
- break;
1918
+ throw await deserializeAws_queryPlatformApplicationDisabledExceptionResponse(parsedOutput, context);
2840
1919
  case "TooManyEntriesInBatchRequestException":
2841
1920
  case "com.amazonaws.sns#TooManyEntriesInBatchRequestException":
2842
- response = {
2843
- ...(await deserializeAws_queryTooManyEntriesInBatchRequestExceptionResponse(parsedOutput, context)),
2844
- name: errorCode,
2845
- $metadata: deserializeMetadata(output),
2846
- };
2847
- break;
1921
+ throw await deserializeAws_queryTooManyEntriesInBatchRequestExceptionResponse(parsedOutput, context);
2848
1922
  default:
2849
1923
  const parsedBody = parsedOutput.body;
2850
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2851
- response = {
2852
- ...parsedBody.Error,
2853
- name: `${errorCode}`,
2854
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1924
+ response = new SNSServiceException_1.SNSServiceException({
1925
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2855
1926
  $fault: "client",
2856
1927
  $metadata: deserializeMetadata(output),
2857
- };
1928
+ });
1929
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2858
1930
  }
2859
- const message = response.message || response.Message || errorCode;
2860
- response.message = message;
2861
- delete response.Message;
2862
- return Promise.reject(Object.assign(new Error(message), response));
2863
1931
  };
2864
1932
  const deserializeAws_queryRemovePermissionCommand = async (output, context) => {
2865
1933
  if (output.statusCode >= 300) {
@@ -2883,51 +1951,25 @@ const deserializeAws_queryRemovePermissionCommandError = async (output, context)
2883
1951
  switch (errorCode) {
2884
1952
  case "AuthorizationErrorException":
2885
1953
  case "com.amazonaws.sns#AuthorizationErrorException":
2886
- response = {
2887
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2888
- name: errorCode,
2889
- $metadata: deserializeMetadata(output),
2890
- };
2891
- break;
1954
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2892
1955
  case "InternalErrorException":
2893
1956
  case "com.amazonaws.sns#InternalErrorException":
2894
- response = {
2895
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2896
- name: errorCode,
2897
- $metadata: deserializeMetadata(output),
2898
- };
2899
- break;
1957
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2900
1958
  case "InvalidParameterException":
2901
1959
  case "com.amazonaws.sns#InvalidParameterException":
2902
- response = {
2903
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2904
- name: errorCode,
2905
- $metadata: deserializeMetadata(output),
2906
- };
2907
- break;
1960
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2908
1961
  case "NotFoundException":
2909
1962
  case "com.amazonaws.sns#NotFoundException":
2910
- response = {
2911
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
2912
- name: errorCode,
2913
- $metadata: deserializeMetadata(output),
2914
- };
2915
- break;
1963
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
2916
1964
  default:
2917
1965
  const parsedBody = parsedOutput.body;
2918
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2919
- response = {
2920
- ...parsedBody.Error,
2921
- name: `${errorCode}`,
2922
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1966
+ response = new SNSServiceException_1.SNSServiceException({
1967
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2923
1968
  $fault: "client",
2924
1969
  $metadata: deserializeMetadata(output),
2925
- };
1970
+ });
1971
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2926
1972
  }
2927
- const message = response.message || response.Message || errorCode;
2928
- response.message = message;
2929
- delete response.Message;
2930
- return Promise.reject(Object.assign(new Error(message), response));
2931
1973
  };
2932
1974
  const deserializeAws_querySetEndpointAttributesCommand = async (output, context) => {
2933
1975
  if (output.statusCode >= 300) {
@@ -2951,51 +1993,25 @@ const deserializeAws_querySetEndpointAttributesCommandError = async (output, con
2951
1993
  switch (errorCode) {
2952
1994
  case "AuthorizationErrorException":
2953
1995
  case "com.amazonaws.sns#AuthorizationErrorException":
2954
- response = {
2955
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
2956
- name: errorCode,
2957
- $metadata: deserializeMetadata(output),
2958
- };
2959
- break;
1996
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
2960
1997
  case "InternalErrorException":
2961
1998
  case "com.amazonaws.sns#InternalErrorException":
2962
- response = {
2963
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
2964
- name: errorCode,
2965
- $metadata: deserializeMetadata(output),
2966
- };
2967
- break;
1999
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
2968
2000
  case "InvalidParameterException":
2969
2001
  case "com.amazonaws.sns#InvalidParameterException":
2970
- response = {
2971
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
2972
- name: errorCode,
2973
- $metadata: deserializeMetadata(output),
2974
- };
2975
- break;
2002
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
2976
2003
  case "NotFoundException":
2977
2004
  case "com.amazonaws.sns#NotFoundException":
2978
- response = {
2979
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
2980
- name: errorCode,
2981
- $metadata: deserializeMetadata(output),
2982
- };
2983
- break;
2005
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
2984
2006
  default:
2985
2007
  const parsedBody = parsedOutput.body;
2986
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2987
- response = {
2988
- ...parsedBody.Error,
2989
- name: `${errorCode}`,
2990
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2008
+ response = new SNSServiceException_1.SNSServiceException({
2009
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2991
2010
  $fault: "client",
2992
2011
  $metadata: deserializeMetadata(output),
2993
- };
2012
+ });
2013
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2994
2014
  }
2995
- const message = response.message || response.Message || errorCode;
2996
- response.message = message;
2997
- delete response.Message;
2998
- return Promise.reject(Object.assign(new Error(message), response));
2999
2015
  };
3000
2016
  const deserializeAws_querySetPlatformApplicationAttributesCommand = async (output, context) => {
3001
2017
  if (output.statusCode >= 300) {
@@ -3019,51 +2035,25 @@ const deserializeAws_querySetPlatformApplicationAttributesCommandError = async (
3019
2035
  switch (errorCode) {
3020
2036
  case "AuthorizationErrorException":
3021
2037
  case "com.amazonaws.sns#AuthorizationErrorException":
3022
- response = {
3023
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3024
- name: errorCode,
3025
- $metadata: deserializeMetadata(output),
3026
- };
3027
- break;
2038
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3028
2039
  case "InternalErrorException":
3029
2040
  case "com.amazonaws.sns#InternalErrorException":
3030
- response = {
3031
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3032
- name: errorCode,
3033
- $metadata: deserializeMetadata(output),
3034
- };
3035
- break;
2041
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3036
2042
  case "InvalidParameterException":
3037
2043
  case "com.amazonaws.sns#InvalidParameterException":
3038
- response = {
3039
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3040
- name: errorCode,
3041
- $metadata: deserializeMetadata(output),
3042
- };
3043
- break;
2044
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3044
2045
  case "NotFoundException":
3045
2046
  case "com.amazonaws.sns#NotFoundException":
3046
- response = {
3047
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
3048
- name: errorCode,
3049
- $metadata: deserializeMetadata(output),
3050
- };
3051
- break;
2047
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
3052
2048
  default:
3053
2049
  const parsedBody = parsedOutput.body;
3054
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3055
- response = {
3056
- ...parsedBody.Error,
3057
- name: `${errorCode}`,
3058
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2050
+ response = new SNSServiceException_1.SNSServiceException({
2051
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3059
2052
  $fault: "client",
3060
2053
  $metadata: deserializeMetadata(output),
3061
- };
2054
+ });
2055
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3062
2056
  }
3063
- const message = response.message || response.Message || errorCode;
3064
- response.message = message;
3065
- delete response.Message;
3066
- return Promise.reject(Object.assign(new Error(message), response));
3067
2057
  };
3068
2058
  const deserializeAws_querySetSMSAttributesCommand = async (output, context) => {
3069
2059
  if (output.statusCode >= 300) {
@@ -3090,51 +2080,25 @@ const deserializeAws_querySetSMSAttributesCommandError = async (output, context)
3090
2080
  switch (errorCode) {
3091
2081
  case "AuthorizationErrorException":
3092
2082
  case "com.amazonaws.sns#AuthorizationErrorException":
3093
- response = {
3094
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3095
- name: errorCode,
3096
- $metadata: deserializeMetadata(output),
3097
- };
3098
- break;
2083
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3099
2084
  case "InternalErrorException":
3100
2085
  case "com.amazonaws.sns#InternalErrorException":
3101
- response = {
3102
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3103
- name: errorCode,
3104
- $metadata: deserializeMetadata(output),
3105
- };
3106
- break;
2086
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3107
2087
  case "InvalidParameterException":
3108
2088
  case "com.amazonaws.sns#InvalidParameterException":
3109
- response = {
3110
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3111
- name: errorCode,
3112
- $metadata: deserializeMetadata(output),
3113
- };
3114
- break;
2089
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3115
2090
  case "ThrottledException":
3116
2091
  case "com.amazonaws.sns#ThrottledException":
3117
- response = {
3118
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
3119
- name: errorCode,
3120
- $metadata: deserializeMetadata(output),
3121
- };
3122
- break;
2092
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
3123
2093
  default:
3124
2094
  const parsedBody = parsedOutput.body;
3125
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3126
- response = {
3127
- ...parsedBody.Error,
3128
- name: `${errorCode}`,
3129
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2095
+ response = new SNSServiceException_1.SNSServiceException({
2096
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3130
2097
  $fault: "client",
3131
2098
  $metadata: deserializeMetadata(output),
3132
- };
2099
+ });
2100
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3133
2101
  }
3134
- const message = response.message || response.Message || errorCode;
3135
- response.message = message;
3136
- delete response.Message;
3137
- return Promise.reject(Object.assign(new Error(message), response));
3138
2102
  };
3139
2103
  const deserializeAws_querySetSubscriptionAttributesCommand = async (output, context) => {
3140
2104
  if (output.statusCode >= 300) {
@@ -3158,59 +2122,28 @@ const deserializeAws_querySetSubscriptionAttributesCommandError = async (output,
3158
2122
  switch (errorCode) {
3159
2123
  case "AuthorizationErrorException":
3160
2124
  case "com.amazonaws.sns#AuthorizationErrorException":
3161
- response = {
3162
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3163
- name: errorCode,
3164
- $metadata: deserializeMetadata(output),
3165
- };
3166
- break;
2125
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3167
2126
  case "FilterPolicyLimitExceededException":
3168
2127
  case "com.amazonaws.sns#FilterPolicyLimitExceededException":
3169
- response = {
3170
- ...(await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context)),
3171
- name: errorCode,
3172
- $metadata: deserializeMetadata(output),
3173
- };
3174
- break;
2128
+ throw await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context);
3175
2129
  case "InternalErrorException":
3176
2130
  case "com.amazonaws.sns#InternalErrorException":
3177
- response = {
3178
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3179
- name: errorCode,
3180
- $metadata: deserializeMetadata(output),
3181
- };
3182
- break;
2131
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3183
2132
  case "InvalidParameterException":
3184
2133
  case "com.amazonaws.sns#InvalidParameterException":
3185
- response = {
3186
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3187
- name: errorCode,
3188
- $metadata: deserializeMetadata(output),
3189
- };
3190
- break;
2134
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3191
2135
  case "NotFoundException":
3192
2136
  case "com.amazonaws.sns#NotFoundException":
3193
- response = {
3194
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
3195
- name: errorCode,
3196
- $metadata: deserializeMetadata(output),
3197
- };
3198
- break;
2137
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
3199
2138
  default:
3200
2139
  const parsedBody = parsedOutput.body;
3201
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3202
- response = {
3203
- ...parsedBody.Error,
3204
- name: `${errorCode}`,
3205
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2140
+ response = new SNSServiceException_1.SNSServiceException({
2141
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3206
2142
  $fault: "client",
3207
2143
  $metadata: deserializeMetadata(output),
3208
- };
2144
+ });
2145
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3209
2146
  }
3210
- const message = response.message || response.Message || errorCode;
3211
- response.message = message;
3212
- delete response.Message;
3213
- return Promise.reject(Object.assign(new Error(message), response));
3214
2147
  };
3215
2148
  const deserializeAws_querySetTopicAttributesCommand = async (output, context) => {
3216
2149
  if (output.statusCode >= 300) {
@@ -3234,59 +2167,28 @@ const deserializeAws_querySetTopicAttributesCommandError = async (output, contex
3234
2167
  switch (errorCode) {
3235
2168
  case "AuthorizationErrorException":
3236
2169
  case "com.amazonaws.sns#AuthorizationErrorException":
3237
- response = {
3238
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3239
- name: errorCode,
3240
- $metadata: deserializeMetadata(output),
3241
- };
3242
- break;
2170
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3243
2171
  case "InternalErrorException":
3244
2172
  case "com.amazonaws.sns#InternalErrorException":
3245
- response = {
3246
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3247
- name: errorCode,
3248
- $metadata: deserializeMetadata(output),
3249
- };
3250
- break;
2173
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3251
2174
  case "InvalidParameterException":
3252
2175
  case "com.amazonaws.sns#InvalidParameterException":
3253
- response = {
3254
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3255
- name: errorCode,
3256
- $metadata: deserializeMetadata(output),
3257
- };
3258
- break;
2176
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3259
2177
  case "InvalidSecurityException":
3260
2178
  case "com.amazonaws.sns#InvalidSecurityException":
3261
- response = {
3262
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
3263
- name: errorCode,
3264
- $metadata: deserializeMetadata(output),
3265
- };
3266
- break;
2179
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
3267
2180
  case "NotFoundException":
3268
2181
  case "com.amazonaws.sns#NotFoundException":
3269
- response = {
3270
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
3271
- name: errorCode,
3272
- $metadata: deserializeMetadata(output),
3273
- };
3274
- break;
2182
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
3275
2183
  default:
3276
2184
  const parsedBody = parsedOutput.body;
3277
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3278
- response = {
3279
- ...parsedBody.Error,
3280
- name: `${errorCode}`,
3281
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2185
+ response = new SNSServiceException_1.SNSServiceException({
2186
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3282
2187
  $fault: "client",
3283
2188
  $metadata: deserializeMetadata(output),
3284
- };
2189
+ });
2190
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3285
2191
  }
3286
- const message = response.message || response.Message || errorCode;
3287
- response.message = message;
3288
- delete response.Message;
3289
- return Promise.reject(Object.assign(new Error(message), response));
3290
2192
  };
3291
2193
  const deserializeAws_querySubscribeCommand = async (output, context) => {
3292
2194
  if (output.statusCode >= 300) {
@@ -3313,75 +2215,34 @@ const deserializeAws_querySubscribeCommandError = async (output, context) => {
3313
2215
  switch (errorCode) {
3314
2216
  case "AuthorizationErrorException":
3315
2217
  case "com.amazonaws.sns#AuthorizationErrorException":
3316
- response = {
3317
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3318
- name: errorCode,
3319
- $metadata: deserializeMetadata(output),
3320
- };
3321
- break;
2218
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3322
2219
  case "FilterPolicyLimitExceededException":
3323
2220
  case "com.amazonaws.sns#FilterPolicyLimitExceededException":
3324
- response = {
3325
- ...(await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context)),
3326
- name: errorCode,
3327
- $metadata: deserializeMetadata(output),
3328
- };
3329
- break;
2221
+ throw await deserializeAws_queryFilterPolicyLimitExceededExceptionResponse(parsedOutput, context);
3330
2222
  case "InternalErrorException":
3331
2223
  case "com.amazonaws.sns#InternalErrorException":
3332
- response = {
3333
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3334
- name: errorCode,
3335
- $metadata: deserializeMetadata(output),
3336
- };
3337
- break;
2224
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3338
2225
  case "InvalidParameterException":
3339
2226
  case "com.amazonaws.sns#InvalidParameterException":
3340
- response = {
3341
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3342
- name: errorCode,
3343
- $metadata: deserializeMetadata(output),
3344
- };
3345
- break;
2227
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3346
2228
  case "InvalidSecurityException":
3347
2229
  case "com.amazonaws.sns#InvalidSecurityException":
3348
- response = {
3349
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
3350
- name: errorCode,
3351
- $metadata: deserializeMetadata(output),
3352
- };
3353
- break;
2230
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
3354
2231
  case "NotFoundException":
3355
2232
  case "com.amazonaws.sns#NotFoundException":
3356
- response = {
3357
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
3358
- name: errorCode,
3359
- $metadata: deserializeMetadata(output),
3360
- };
3361
- break;
2233
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
3362
2234
  case "SubscriptionLimitExceededException":
3363
2235
  case "com.amazonaws.sns#SubscriptionLimitExceededException":
3364
- response = {
3365
- ...(await deserializeAws_querySubscriptionLimitExceededExceptionResponse(parsedOutput, context)),
3366
- name: errorCode,
3367
- $metadata: deserializeMetadata(output),
3368
- };
3369
- break;
2236
+ throw await deserializeAws_querySubscriptionLimitExceededExceptionResponse(parsedOutput, context);
3370
2237
  default:
3371
2238
  const parsedBody = parsedOutput.body;
3372
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3373
- response = {
3374
- ...parsedBody.Error,
3375
- name: `${errorCode}`,
3376
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2239
+ response = new SNSServiceException_1.SNSServiceException({
2240
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3377
2241
  $fault: "client",
3378
2242
  $metadata: deserializeMetadata(output),
3379
- };
2243
+ });
2244
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3380
2245
  }
3381
- const message = response.message || response.Message || errorCode;
3382
- response.message = message;
3383
- delete response.Message;
3384
- return Promise.reject(Object.assign(new Error(message), response));
3385
2246
  };
3386
2247
  const deserializeAws_queryTagResourceCommand = async (output, context) => {
3387
2248
  if (output.statusCode >= 300) {
@@ -3408,75 +2269,34 @@ const deserializeAws_queryTagResourceCommandError = async (output, context) => {
3408
2269
  switch (errorCode) {
3409
2270
  case "AuthorizationErrorException":
3410
2271
  case "com.amazonaws.sns#AuthorizationErrorException":
3411
- response = {
3412
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3413
- name: errorCode,
3414
- $metadata: deserializeMetadata(output),
3415
- };
3416
- break;
2272
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3417
2273
  case "ConcurrentAccessException":
3418
2274
  case "com.amazonaws.sns#ConcurrentAccessException":
3419
- response = {
3420
- ...(await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context)),
3421
- name: errorCode,
3422
- $metadata: deserializeMetadata(output),
3423
- };
3424
- break;
2275
+ throw await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context);
3425
2276
  case "InvalidParameterException":
3426
2277
  case "com.amazonaws.sns#InvalidParameterException":
3427
- response = {
3428
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3429
- name: errorCode,
3430
- $metadata: deserializeMetadata(output),
3431
- };
3432
- break;
2278
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3433
2279
  case "ResourceNotFoundException":
3434
2280
  case "com.amazonaws.sns#ResourceNotFoundException":
3435
- response = {
3436
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
3437
- name: errorCode,
3438
- $metadata: deserializeMetadata(output),
3439
- };
3440
- break;
2281
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
3441
2282
  case "StaleTagException":
3442
2283
  case "com.amazonaws.sns#StaleTagException":
3443
- response = {
3444
- ...(await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context)),
3445
- name: errorCode,
3446
- $metadata: deserializeMetadata(output),
3447
- };
3448
- break;
2284
+ throw await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context);
3449
2285
  case "TagLimitExceededException":
3450
2286
  case "com.amazonaws.sns#TagLimitExceededException":
3451
- response = {
3452
- ...(await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context)),
3453
- name: errorCode,
3454
- $metadata: deserializeMetadata(output),
3455
- };
3456
- break;
2287
+ throw await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context);
3457
2288
  case "TagPolicyException":
3458
2289
  case "com.amazonaws.sns#TagPolicyException":
3459
- response = {
3460
- ...(await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context)),
3461
- name: errorCode,
3462
- $metadata: deserializeMetadata(output),
3463
- };
3464
- break;
2290
+ throw await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context);
3465
2291
  default:
3466
2292
  const parsedBody = parsedOutput.body;
3467
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3468
- response = {
3469
- ...parsedBody.Error,
3470
- name: `${errorCode}`,
3471
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2293
+ response = new SNSServiceException_1.SNSServiceException({
2294
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3472
2295
  $fault: "client",
3473
2296
  $metadata: deserializeMetadata(output),
3474
- };
2297
+ });
2298
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3475
2299
  }
3476
- const message = response.message || response.Message || errorCode;
3477
- response.message = message;
3478
- delete response.Message;
3479
- return Promise.reject(Object.assign(new Error(message), response));
3480
2300
  };
3481
2301
  const deserializeAws_queryUnsubscribeCommand = async (output, context) => {
3482
2302
  if (output.statusCode >= 300) {
@@ -3500,59 +2320,28 @@ const deserializeAws_queryUnsubscribeCommandError = async (output, context) => {
3500
2320
  switch (errorCode) {
3501
2321
  case "AuthorizationErrorException":
3502
2322
  case "com.amazonaws.sns#AuthorizationErrorException":
3503
- response = {
3504
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3505
- name: errorCode,
3506
- $metadata: deserializeMetadata(output),
3507
- };
3508
- break;
2323
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3509
2324
  case "InternalErrorException":
3510
2325
  case "com.amazonaws.sns#InternalErrorException":
3511
- response = {
3512
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3513
- name: errorCode,
3514
- $metadata: deserializeMetadata(output),
3515
- };
3516
- break;
2326
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3517
2327
  case "InvalidParameterException":
3518
2328
  case "com.amazonaws.sns#InvalidParameterException":
3519
- response = {
3520
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3521
- name: errorCode,
3522
- $metadata: deserializeMetadata(output),
3523
- };
3524
- break;
2329
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3525
2330
  case "InvalidSecurityException":
3526
2331
  case "com.amazonaws.sns#InvalidSecurityException":
3527
- response = {
3528
- ...(await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context)),
3529
- name: errorCode,
3530
- $metadata: deserializeMetadata(output),
3531
- };
3532
- break;
2332
+ throw await deserializeAws_queryInvalidSecurityExceptionResponse(parsedOutput, context);
3533
2333
  case "NotFoundException":
3534
2334
  case "com.amazonaws.sns#NotFoundException":
3535
- response = {
3536
- ...(await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context)),
3537
- name: errorCode,
3538
- $metadata: deserializeMetadata(output),
3539
- };
3540
- break;
2335
+ throw await deserializeAws_queryNotFoundExceptionResponse(parsedOutput, context);
3541
2336
  default:
3542
2337
  const parsedBody = parsedOutput.body;
3543
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3544
- response = {
3545
- ...parsedBody.Error,
3546
- name: `${errorCode}`,
3547
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2338
+ response = new SNSServiceException_1.SNSServiceException({
2339
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3548
2340
  $fault: "client",
3549
2341
  $metadata: deserializeMetadata(output),
3550
- };
2342
+ });
2343
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3551
2344
  }
3552
- const message = response.message || response.Message || errorCode;
3553
- response.message = message;
3554
- delete response.Message;
3555
- return Promise.reject(Object.assign(new Error(message), response));
3556
2345
  };
3557
2346
  const deserializeAws_queryUntagResourceCommand = async (output, context) => {
3558
2347
  if (output.statusCode >= 300) {
@@ -3579,75 +2368,34 @@ const deserializeAws_queryUntagResourceCommandError = async (output, context) =>
3579
2368
  switch (errorCode) {
3580
2369
  case "AuthorizationErrorException":
3581
2370
  case "com.amazonaws.sns#AuthorizationErrorException":
3582
- response = {
3583
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3584
- name: errorCode,
3585
- $metadata: deserializeMetadata(output),
3586
- };
3587
- break;
2371
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3588
2372
  case "ConcurrentAccessException":
3589
2373
  case "com.amazonaws.sns#ConcurrentAccessException":
3590
- response = {
3591
- ...(await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context)),
3592
- name: errorCode,
3593
- $metadata: deserializeMetadata(output),
3594
- };
3595
- break;
2374
+ throw await deserializeAws_queryConcurrentAccessExceptionResponse(parsedOutput, context);
3596
2375
  case "InvalidParameterException":
3597
2376
  case "com.amazonaws.sns#InvalidParameterException":
3598
- response = {
3599
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3600
- name: errorCode,
3601
- $metadata: deserializeMetadata(output),
3602
- };
3603
- break;
2377
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3604
2378
  case "ResourceNotFoundException":
3605
2379
  case "com.amazonaws.sns#ResourceNotFoundException":
3606
- response = {
3607
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
3608
- name: errorCode,
3609
- $metadata: deserializeMetadata(output),
3610
- };
3611
- break;
2380
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
3612
2381
  case "StaleTagException":
3613
2382
  case "com.amazonaws.sns#StaleTagException":
3614
- response = {
3615
- ...(await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context)),
3616
- name: errorCode,
3617
- $metadata: deserializeMetadata(output),
3618
- };
3619
- break;
2383
+ throw await deserializeAws_queryStaleTagExceptionResponse(parsedOutput, context);
3620
2384
  case "TagLimitExceededException":
3621
2385
  case "com.amazonaws.sns#TagLimitExceededException":
3622
- response = {
3623
- ...(await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context)),
3624
- name: errorCode,
3625
- $metadata: deserializeMetadata(output),
3626
- };
3627
- break;
2386
+ throw await deserializeAws_queryTagLimitExceededExceptionResponse(parsedOutput, context);
3628
2387
  case "TagPolicyException":
3629
2388
  case "com.amazonaws.sns#TagPolicyException":
3630
- response = {
3631
- ...(await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context)),
3632
- name: errorCode,
3633
- $metadata: deserializeMetadata(output),
3634
- };
3635
- break;
2389
+ throw await deserializeAws_queryTagPolicyExceptionResponse(parsedOutput, context);
3636
2390
  default:
3637
2391
  const parsedBody = parsedOutput.body;
3638
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3639
- response = {
3640
- ...parsedBody.Error,
3641
- name: `${errorCode}`,
3642
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2392
+ response = new SNSServiceException_1.SNSServiceException({
2393
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3643
2394
  $fault: "client",
3644
2395
  $metadata: deserializeMetadata(output),
3645
- };
2396
+ });
2397
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3646
2398
  }
3647
- const message = response.message || response.Message || errorCode;
3648
- response.message = message;
3649
- delete response.Message;
3650
- return Promise.reject(Object.assign(new Error(message), response));
3651
2399
  };
3652
2400
  const deserializeAws_queryVerifySMSSandboxPhoneNumberCommand = async (output, context) => {
3653
2401
  if (output.statusCode >= 300) {
@@ -3674,419 +2422,319 @@ const deserializeAws_queryVerifySMSSandboxPhoneNumberCommandError = async (outpu
3674
2422
  switch (errorCode) {
3675
2423
  case "AuthorizationErrorException":
3676
2424
  case "com.amazonaws.sns#AuthorizationErrorException":
3677
- response = {
3678
- ...(await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context)),
3679
- name: errorCode,
3680
- $metadata: deserializeMetadata(output),
3681
- };
3682
- break;
2425
+ throw await deserializeAws_queryAuthorizationErrorExceptionResponse(parsedOutput, context);
3683
2426
  case "InternalErrorException":
3684
2427
  case "com.amazonaws.sns#InternalErrorException":
3685
- response = {
3686
- ...(await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context)),
3687
- name: errorCode,
3688
- $metadata: deserializeMetadata(output),
3689
- };
3690
- break;
2428
+ throw await deserializeAws_queryInternalErrorExceptionResponse(parsedOutput, context);
3691
2429
  case "InvalidParameterException":
3692
2430
  case "com.amazonaws.sns#InvalidParameterException":
3693
- response = {
3694
- ...(await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context)),
3695
- name: errorCode,
3696
- $metadata: deserializeMetadata(output),
3697
- };
3698
- break;
2431
+ throw await deserializeAws_queryInvalidParameterExceptionResponse(parsedOutput, context);
3699
2432
  case "ResourceNotFoundException":
3700
2433
  case "com.amazonaws.sns#ResourceNotFoundException":
3701
- response = {
3702
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
3703
- name: errorCode,
3704
- $metadata: deserializeMetadata(output),
3705
- };
3706
- break;
2434
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
3707
2435
  case "ThrottledException":
3708
2436
  case "com.amazonaws.sns#ThrottledException":
3709
- response = {
3710
- ...(await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context)),
3711
- name: errorCode,
3712
- $metadata: deserializeMetadata(output),
3713
- };
3714
- break;
2437
+ throw await deserializeAws_queryThrottledExceptionResponse(parsedOutput, context);
3715
2438
  case "VerificationException":
3716
2439
  case "com.amazonaws.sns#VerificationException":
3717
- response = {
3718
- ...(await deserializeAws_queryVerificationExceptionResponse(parsedOutput, context)),
3719
- name: errorCode,
3720
- $metadata: deserializeMetadata(output),
3721
- };
3722
- break;
2440
+ throw await deserializeAws_queryVerificationExceptionResponse(parsedOutput, context);
3723
2441
  default:
3724
2442
  const parsedBody = parsedOutput.body;
3725
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
3726
- response = {
3727
- ...parsedBody.Error,
3728
- name: `${errorCode}`,
3729
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
2443
+ response = new SNSServiceException_1.SNSServiceException({
2444
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
3730
2445
  $fault: "client",
3731
2446
  $metadata: deserializeMetadata(output),
3732
- };
2447
+ });
2448
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
3733
2449
  }
3734
- const message = response.message || response.Message || errorCode;
3735
- response.message = message;
3736
- delete response.Message;
3737
- return Promise.reject(Object.assign(new Error(message), response));
3738
2450
  };
3739
2451
  const deserializeAws_queryAuthorizationErrorExceptionResponse = async (parsedOutput, context) => {
3740
2452
  const body = parsedOutput.body;
3741
2453
  const deserialized = deserializeAws_queryAuthorizationErrorException(body.Error, context);
3742
- const contents = {
3743
- name: "AuthorizationErrorException",
3744
- $fault: "client",
2454
+ const exception = new models_0_1.AuthorizationErrorException({
3745
2455
  $metadata: deserializeMetadata(parsedOutput),
3746
2456
  ...deserialized,
3747
- };
3748
- return contents;
2457
+ });
2458
+ return smithy_client_1.decorateServiceException(exception, body);
3749
2459
  };
3750
2460
  const deserializeAws_queryBatchEntryIdsNotDistinctExceptionResponse = async (parsedOutput, context) => {
3751
2461
  const body = parsedOutput.body;
3752
2462
  const deserialized = deserializeAws_queryBatchEntryIdsNotDistinctException(body.Error, context);
3753
- const contents = {
3754
- name: "BatchEntryIdsNotDistinctException",
3755
- $fault: "client",
2463
+ const exception = new models_0_1.BatchEntryIdsNotDistinctException({
3756
2464
  $metadata: deserializeMetadata(parsedOutput),
3757
2465
  ...deserialized,
3758
- };
3759
- return contents;
2466
+ });
2467
+ return smithy_client_1.decorateServiceException(exception, body);
3760
2468
  };
3761
2469
  const deserializeAws_queryBatchRequestTooLongExceptionResponse = async (parsedOutput, context) => {
3762
2470
  const body = parsedOutput.body;
3763
2471
  const deserialized = deserializeAws_queryBatchRequestTooLongException(body.Error, context);
3764
- const contents = {
3765
- name: "BatchRequestTooLongException",
3766
- $fault: "client",
2472
+ const exception = new models_0_1.BatchRequestTooLongException({
3767
2473
  $metadata: deserializeMetadata(parsedOutput),
3768
2474
  ...deserialized,
3769
- };
3770
- return contents;
2475
+ });
2476
+ return smithy_client_1.decorateServiceException(exception, body);
3771
2477
  };
3772
2478
  const deserializeAws_queryConcurrentAccessExceptionResponse = async (parsedOutput, context) => {
3773
2479
  const body = parsedOutput.body;
3774
2480
  const deserialized = deserializeAws_queryConcurrentAccessException(body.Error, context);
3775
- const contents = {
3776
- name: "ConcurrentAccessException",
3777
- $fault: "client",
2481
+ const exception = new models_0_1.ConcurrentAccessException({
3778
2482
  $metadata: deserializeMetadata(parsedOutput),
3779
2483
  ...deserialized,
3780
- };
3781
- return contents;
2484
+ });
2485
+ return smithy_client_1.decorateServiceException(exception, body);
3782
2486
  };
3783
2487
  const deserializeAws_queryEmptyBatchRequestExceptionResponse = async (parsedOutput, context) => {
3784
2488
  const body = parsedOutput.body;
3785
2489
  const deserialized = deserializeAws_queryEmptyBatchRequestException(body.Error, context);
3786
- const contents = {
3787
- name: "EmptyBatchRequestException",
3788
- $fault: "client",
2490
+ const exception = new models_0_1.EmptyBatchRequestException({
3789
2491
  $metadata: deserializeMetadata(parsedOutput),
3790
2492
  ...deserialized,
3791
- };
3792
- return contents;
2493
+ });
2494
+ return smithy_client_1.decorateServiceException(exception, body);
3793
2495
  };
3794
2496
  const deserializeAws_queryEndpointDisabledExceptionResponse = async (parsedOutput, context) => {
3795
2497
  const body = parsedOutput.body;
3796
2498
  const deserialized = deserializeAws_queryEndpointDisabledException(body.Error, context);
3797
- const contents = {
3798
- name: "EndpointDisabledException",
3799
- $fault: "client",
2499
+ const exception = new models_0_1.EndpointDisabledException({
3800
2500
  $metadata: deserializeMetadata(parsedOutput),
3801
2501
  ...deserialized,
3802
- };
3803
- return contents;
2502
+ });
2503
+ return smithy_client_1.decorateServiceException(exception, body);
3804
2504
  };
3805
2505
  const deserializeAws_queryFilterPolicyLimitExceededExceptionResponse = async (parsedOutput, context) => {
3806
2506
  const body = parsedOutput.body;
3807
2507
  const deserialized = deserializeAws_queryFilterPolicyLimitExceededException(body.Error, context);
3808
- const contents = {
3809
- name: "FilterPolicyLimitExceededException",
3810
- $fault: "client",
2508
+ const exception = new models_0_1.FilterPolicyLimitExceededException({
3811
2509
  $metadata: deserializeMetadata(parsedOutput),
3812
2510
  ...deserialized,
3813
- };
3814
- return contents;
2511
+ });
2512
+ return smithy_client_1.decorateServiceException(exception, body);
3815
2513
  };
3816
2514
  const deserializeAws_queryInternalErrorExceptionResponse = async (parsedOutput, context) => {
3817
2515
  const body = parsedOutput.body;
3818
2516
  const deserialized = deserializeAws_queryInternalErrorException(body.Error, context);
3819
- const contents = {
3820
- name: "InternalErrorException",
3821
- $fault: "server",
2517
+ const exception = new models_0_1.InternalErrorException({
3822
2518
  $metadata: deserializeMetadata(parsedOutput),
3823
2519
  ...deserialized,
3824
- };
3825
- return contents;
2520
+ });
2521
+ return smithy_client_1.decorateServiceException(exception, body);
3826
2522
  };
3827
2523
  const deserializeAws_queryInvalidBatchEntryIdExceptionResponse = async (parsedOutput, context) => {
3828
2524
  const body = parsedOutput.body;
3829
2525
  const deserialized = deserializeAws_queryInvalidBatchEntryIdException(body.Error, context);
3830
- const contents = {
3831
- name: "InvalidBatchEntryIdException",
3832
- $fault: "client",
2526
+ const exception = new models_0_1.InvalidBatchEntryIdException({
3833
2527
  $metadata: deserializeMetadata(parsedOutput),
3834
2528
  ...deserialized,
3835
- };
3836
- return contents;
2529
+ });
2530
+ return smithy_client_1.decorateServiceException(exception, body);
3837
2531
  };
3838
2532
  const deserializeAws_queryInvalidParameterExceptionResponse = async (parsedOutput, context) => {
3839
2533
  const body = parsedOutput.body;
3840
2534
  const deserialized = deserializeAws_queryInvalidParameterException(body.Error, context);
3841
- const contents = {
3842
- name: "InvalidParameterException",
3843
- $fault: "client",
2535
+ const exception = new models_0_1.InvalidParameterException({
3844
2536
  $metadata: deserializeMetadata(parsedOutput),
3845
2537
  ...deserialized,
3846
- };
3847
- return contents;
2538
+ });
2539
+ return smithy_client_1.decorateServiceException(exception, body);
3848
2540
  };
3849
2541
  const deserializeAws_queryInvalidParameterValueExceptionResponse = async (parsedOutput, context) => {
3850
2542
  const body = parsedOutput.body;
3851
2543
  const deserialized = deserializeAws_queryInvalidParameterValueException(body.Error, context);
3852
- const contents = {
3853
- name: "InvalidParameterValueException",
3854
- $fault: "client",
2544
+ const exception = new models_0_1.InvalidParameterValueException({
3855
2545
  $metadata: deserializeMetadata(parsedOutput),
3856
2546
  ...deserialized,
3857
- };
3858
- return contents;
2547
+ });
2548
+ return smithy_client_1.decorateServiceException(exception, body);
3859
2549
  };
3860
2550
  const deserializeAws_queryInvalidSecurityExceptionResponse = async (parsedOutput, context) => {
3861
2551
  const body = parsedOutput.body;
3862
2552
  const deserialized = deserializeAws_queryInvalidSecurityException(body.Error, context);
3863
- const contents = {
3864
- name: "InvalidSecurityException",
3865
- $fault: "client",
2553
+ const exception = new models_0_1.InvalidSecurityException({
3866
2554
  $metadata: deserializeMetadata(parsedOutput),
3867
2555
  ...deserialized,
3868
- };
3869
- return contents;
2556
+ });
2557
+ return smithy_client_1.decorateServiceException(exception, body);
3870
2558
  };
3871
2559
  const deserializeAws_queryKMSAccessDeniedExceptionResponse = async (parsedOutput, context) => {
3872
2560
  const body = parsedOutput.body;
3873
2561
  const deserialized = deserializeAws_queryKMSAccessDeniedException(body.Error, context);
3874
- const contents = {
3875
- name: "KMSAccessDeniedException",
3876
- $fault: "client",
2562
+ const exception = new models_0_1.KMSAccessDeniedException({
3877
2563
  $metadata: deserializeMetadata(parsedOutput),
3878
2564
  ...deserialized,
3879
- };
3880
- return contents;
2565
+ });
2566
+ return smithy_client_1.decorateServiceException(exception, body);
3881
2567
  };
3882
2568
  const deserializeAws_queryKMSDisabledExceptionResponse = async (parsedOutput, context) => {
3883
2569
  const body = parsedOutput.body;
3884
2570
  const deserialized = deserializeAws_queryKMSDisabledException(body.Error, context);
3885
- const contents = {
3886
- name: "KMSDisabledException",
3887
- $fault: "client",
2571
+ const exception = new models_0_1.KMSDisabledException({
3888
2572
  $metadata: deserializeMetadata(parsedOutput),
3889
2573
  ...deserialized,
3890
- };
3891
- return contents;
2574
+ });
2575
+ return smithy_client_1.decorateServiceException(exception, body);
3892
2576
  };
3893
2577
  const deserializeAws_queryKMSInvalidStateExceptionResponse = async (parsedOutput, context) => {
3894
2578
  const body = parsedOutput.body;
3895
2579
  const deserialized = deserializeAws_queryKMSInvalidStateException(body.Error, context);
3896
- const contents = {
3897
- name: "KMSInvalidStateException",
3898
- $fault: "client",
2580
+ const exception = new models_0_1.KMSInvalidStateException({
3899
2581
  $metadata: deserializeMetadata(parsedOutput),
3900
2582
  ...deserialized,
3901
- };
3902
- return contents;
2583
+ });
2584
+ return smithy_client_1.decorateServiceException(exception, body);
3903
2585
  };
3904
2586
  const deserializeAws_queryKMSNotFoundExceptionResponse = async (parsedOutput, context) => {
3905
2587
  const body = parsedOutput.body;
3906
2588
  const deserialized = deserializeAws_queryKMSNotFoundException(body.Error, context);
3907
- const contents = {
3908
- name: "KMSNotFoundException",
3909
- $fault: "client",
2589
+ const exception = new models_0_1.KMSNotFoundException({
3910
2590
  $metadata: deserializeMetadata(parsedOutput),
3911
2591
  ...deserialized,
3912
- };
3913
- return contents;
2592
+ });
2593
+ return smithy_client_1.decorateServiceException(exception, body);
3914
2594
  };
3915
2595
  const deserializeAws_queryKMSOptInRequiredResponse = async (parsedOutput, context) => {
3916
2596
  const body = parsedOutput.body;
3917
2597
  const deserialized = deserializeAws_queryKMSOptInRequired(body.Error, context);
3918
- const contents = {
3919
- name: "KMSOptInRequired",
3920
- $fault: "client",
2598
+ const exception = new models_0_1.KMSOptInRequired({
3921
2599
  $metadata: deserializeMetadata(parsedOutput),
3922
2600
  ...deserialized,
3923
- };
3924
- return contents;
2601
+ });
2602
+ return smithy_client_1.decorateServiceException(exception, body);
3925
2603
  };
3926
2604
  const deserializeAws_queryKMSThrottlingExceptionResponse = async (parsedOutput, context) => {
3927
2605
  const body = parsedOutput.body;
3928
2606
  const deserialized = deserializeAws_queryKMSThrottlingException(body.Error, context);
3929
- const contents = {
3930
- name: "KMSThrottlingException",
3931
- $fault: "client",
2607
+ const exception = new models_0_1.KMSThrottlingException({
3932
2608
  $metadata: deserializeMetadata(parsedOutput),
3933
2609
  ...deserialized,
3934
- };
3935
- return contents;
2610
+ });
2611
+ return smithy_client_1.decorateServiceException(exception, body);
3936
2612
  };
3937
2613
  const deserializeAws_queryNotFoundExceptionResponse = async (parsedOutput, context) => {
3938
2614
  const body = parsedOutput.body;
3939
2615
  const deserialized = deserializeAws_queryNotFoundException(body.Error, context);
3940
- const contents = {
3941
- name: "NotFoundException",
3942
- $fault: "client",
2616
+ const exception = new models_0_1.NotFoundException({
3943
2617
  $metadata: deserializeMetadata(parsedOutput),
3944
2618
  ...deserialized,
3945
- };
3946
- return contents;
2619
+ });
2620
+ return smithy_client_1.decorateServiceException(exception, body);
3947
2621
  };
3948
2622
  const deserializeAws_queryOptedOutExceptionResponse = async (parsedOutput, context) => {
3949
2623
  const body = parsedOutput.body;
3950
2624
  const deserialized = deserializeAws_queryOptedOutException(body.Error, context);
3951
- const contents = {
3952
- name: "OptedOutException",
3953
- $fault: "client",
2625
+ const exception = new models_0_1.OptedOutException({
3954
2626
  $metadata: deserializeMetadata(parsedOutput),
3955
2627
  ...deserialized,
3956
- };
3957
- return contents;
2628
+ });
2629
+ return smithy_client_1.decorateServiceException(exception, body);
3958
2630
  };
3959
2631
  const deserializeAws_queryPlatformApplicationDisabledExceptionResponse = async (parsedOutput, context) => {
3960
2632
  const body = parsedOutput.body;
3961
2633
  const deserialized = deserializeAws_queryPlatformApplicationDisabledException(body.Error, context);
3962
- const contents = {
3963
- name: "PlatformApplicationDisabledException",
3964
- $fault: "client",
2634
+ const exception = new models_0_1.PlatformApplicationDisabledException({
3965
2635
  $metadata: deserializeMetadata(parsedOutput),
3966
2636
  ...deserialized,
3967
- };
3968
- return contents;
2637
+ });
2638
+ return smithy_client_1.decorateServiceException(exception, body);
3969
2639
  };
3970
2640
  const deserializeAws_queryResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3971
2641
  const body = parsedOutput.body;
3972
2642
  const deserialized = deserializeAws_queryResourceNotFoundException(body.Error, context);
3973
- const contents = {
3974
- name: "ResourceNotFoundException",
3975
- $fault: "client",
2643
+ const exception = new models_0_1.ResourceNotFoundException({
3976
2644
  $metadata: deserializeMetadata(parsedOutput),
3977
2645
  ...deserialized,
3978
- };
3979
- return contents;
2646
+ });
2647
+ return smithy_client_1.decorateServiceException(exception, body);
3980
2648
  };
3981
2649
  const deserializeAws_queryStaleTagExceptionResponse = async (parsedOutput, context) => {
3982
2650
  const body = parsedOutput.body;
3983
2651
  const deserialized = deserializeAws_queryStaleTagException(body.Error, context);
3984
- const contents = {
3985
- name: "StaleTagException",
3986
- $fault: "client",
2652
+ const exception = new models_0_1.StaleTagException({
3987
2653
  $metadata: deserializeMetadata(parsedOutput),
3988
2654
  ...deserialized,
3989
- };
3990
- return contents;
2655
+ });
2656
+ return smithy_client_1.decorateServiceException(exception, body);
3991
2657
  };
3992
2658
  const deserializeAws_querySubscriptionLimitExceededExceptionResponse = async (parsedOutput, context) => {
3993
2659
  const body = parsedOutput.body;
3994
2660
  const deserialized = deserializeAws_querySubscriptionLimitExceededException(body.Error, context);
3995
- const contents = {
3996
- name: "SubscriptionLimitExceededException",
3997
- $fault: "client",
2661
+ const exception = new models_0_1.SubscriptionLimitExceededException({
3998
2662
  $metadata: deserializeMetadata(parsedOutput),
3999
2663
  ...deserialized,
4000
- };
4001
- return contents;
2664
+ });
2665
+ return smithy_client_1.decorateServiceException(exception, body);
4002
2666
  };
4003
2667
  const deserializeAws_queryTagLimitExceededExceptionResponse = async (parsedOutput, context) => {
4004
2668
  const body = parsedOutput.body;
4005
2669
  const deserialized = deserializeAws_queryTagLimitExceededException(body.Error, context);
4006
- const contents = {
4007
- name: "TagLimitExceededException",
4008
- $fault: "client",
2670
+ const exception = new models_0_1.TagLimitExceededException({
4009
2671
  $metadata: deserializeMetadata(parsedOutput),
4010
2672
  ...deserialized,
4011
- };
4012
- return contents;
2673
+ });
2674
+ return smithy_client_1.decorateServiceException(exception, body);
4013
2675
  };
4014
2676
  const deserializeAws_queryTagPolicyExceptionResponse = async (parsedOutput, context) => {
4015
2677
  const body = parsedOutput.body;
4016
2678
  const deserialized = deserializeAws_queryTagPolicyException(body.Error, context);
4017
- const contents = {
4018
- name: "TagPolicyException",
4019
- $fault: "client",
2679
+ const exception = new models_0_1.TagPolicyException({
4020
2680
  $metadata: deserializeMetadata(parsedOutput),
4021
2681
  ...deserialized,
4022
- };
4023
- return contents;
2682
+ });
2683
+ return smithy_client_1.decorateServiceException(exception, body);
4024
2684
  };
4025
2685
  const deserializeAws_queryThrottledExceptionResponse = async (parsedOutput, context) => {
4026
2686
  const body = parsedOutput.body;
4027
2687
  const deserialized = deserializeAws_queryThrottledException(body.Error, context);
4028
- const contents = {
4029
- name: "ThrottledException",
4030
- $fault: "client",
2688
+ const exception = new models_0_1.ThrottledException({
4031
2689
  $metadata: deserializeMetadata(parsedOutput),
4032
2690
  ...deserialized,
4033
- };
4034
- return contents;
2691
+ });
2692
+ return smithy_client_1.decorateServiceException(exception, body);
4035
2693
  };
4036
2694
  const deserializeAws_queryTooManyEntriesInBatchRequestExceptionResponse = async (parsedOutput, context) => {
4037
2695
  const body = parsedOutput.body;
4038
2696
  const deserialized = deserializeAws_queryTooManyEntriesInBatchRequestException(body.Error, context);
4039
- const contents = {
4040
- name: "TooManyEntriesInBatchRequestException",
4041
- $fault: "client",
2697
+ const exception = new models_0_1.TooManyEntriesInBatchRequestException({
4042
2698
  $metadata: deserializeMetadata(parsedOutput),
4043
2699
  ...deserialized,
4044
- };
4045
- return contents;
2700
+ });
2701
+ return smithy_client_1.decorateServiceException(exception, body);
4046
2702
  };
4047
2703
  const deserializeAws_queryTopicLimitExceededExceptionResponse = async (parsedOutput, context) => {
4048
2704
  const body = parsedOutput.body;
4049
2705
  const deserialized = deserializeAws_queryTopicLimitExceededException(body.Error, context);
4050
- const contents = {
4051
- name: "TopicLimitExceededException",
4052
- $fault: "client",
2706
+ const exception = new models_0_1.TopicLimitExceededException({
4053
2707
  $metadata: deserializeMetadata(parsedOutput),
4054
2708
  ...deserialized,
4055
- };
4056
- return contents;
2709
+ });
2710
+ return smithy_client_1.decorateServiceException(exception, body);
4057
2711
  };
4058
2712
  const deserializeAws_queryUserErrorExceptionResponse = async (parsedOutput, context) => {
4059
2713
  const body = parsedOutput.body;
4060
2714
  const deserialized = deserializeAws_queryUserErrorException(body.Error, context);
4061
- const contents = {
4062
- name: "UserErrorException",
4063
- $fault: "client",
2715
+ const exception = new models_0_1.UserErrorException({
4064
2716
  $metadata: deserializeMetadata(parsedOutput),
4065
2717
  ...deserialized,
4066
- };
4067
- return contents;
2718
+ });
2719
+ return smithy_client_1.decorateServiceException(exception, body);
4068
2720
  };
4069
2721
  const deserializeAws_queryValidationExceptionResponse = async (parsedOutput, context) => {
4070
2722
  const body = parsedOutput.body;
4071
2723
  const deserialized = deserializeAws_queryValidationException(body.Error, context);
4072
- const contents = {
4073
- name: "ValidationException",
4074
- $fault: "client",
2724
+ const exception = new models_0_1.ValidationException({
4075
2725
  $metadata: deserializeMetadata(parsedOutput),
4076
2726
  ...deserialized,
4077
- };
4078
- return contents;
2727
+ });
2728
+ return smithy_client_1.decorateServiceException(exception, body);
4079
2729
  };
4080
2730
  const deserializeAws_queryVerificationExceptionResponse = async (parsedOutput, context) => {
4081
2731
  const body = parsedOutput.body;
4082
2732
  const deserialized = deserializeAws_queryVerificationException(body.Error, context);
4083
- const contents = {
4084
- name: "VerificationException",
4085
- $fault: "client",
2733
+ const exception = new models_0_1.VerificationException({
4086
2734
  $metadata: deserializeMetadata(parsedOutput),
4087
2735
  ...deserialized,
4088
- };
4089
- return contents;
2736
+ });
2737
+ return smithy_client_1.decorateServiceException(exception, body);
4090
2738
  };
4091
2739
  const serializeAws_queryActionsList = (input, context) => {
4092
2740
  const entries = {};