@aws-sdk/client-cognito-sync 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.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_restJson1UpdateRecordsCommand = exports.deserializeAws_restJson1UnsubscribeFromDatasetCommand = exports.deserializeAws_restJson1SubscribeToDatasetCommand = exports.deserializeAws_restJson1SetIdentityPoolConfigurationCommand = exports.deserializeAws_restJson1SetCognitoEventsCommand = exports.deserializeAws_restJson1RegisterDeviceCommand = exports.deserializeAws_restJson1ListRecordsCommand = exports.deserializeAws_restJson1ListIdentityPoolUsageCommand = exports.deserializeAws_restJson1ListDatasetsCommand = exports.deserializeAws_restJson1GetIdentityPoolConfigurationCommand = exports.deserializeAws_restJson1GetCognitoEventsCommand = exports.deserializeAws_restJson1GetBulkPublishDetailsCommand = exports.deserializeAws_restJson1DescribeIdentityUsageCommand = exports.deserializeAws_restJson1DescribeIdentityPoolUsageCommand = exports.deserializeAws_restJson1DescribeDatasetCommand = exports.deserializeAws_restJson1DeleteDatasetCommand = exports.deserializeAws_restJson1BulkPublishCommand = exports.serializeAws_restJson1UpdateRecordsCommand = exports.serializeAws_restJson1UnsubscribeFromDatasetCommand = exports.serializeAws_restJson1SubscribeToDatasetCommand = exports.serializeAws_restJson1SetIdentityPoolConfigurationCommand = exports.serializeAws_restJson1SetCognitoEventsCommand = exports.serializeAws_restJson1RegisterDeviceCommand = exports.serializeAws_restJson1ListRecordsCommand = exports.serializeAws_restJson1ListIdentityPoolUsageCommand = exports.serializeAws_restJson1ListDatasetsCommand = exports.serializeAws_restJson1GetIdentityPoolConfigurationCommand = exports.serializeAws_restJson1GetCognitoEventsCommand = exports.serializeAws_restJson1GetBulkPublishDetailsCommand = exports.serializeAws_restJson1DescribeIdentityUsageCommand = exports.serializeAws_restJson1DescribeIdentityPoolUsageCommand = exports.serializeAws_restJson1DescribeDatasetCommand = exports.serializeAws_restJson1DeleteDatasetCommand = exports.serializeAws_restJson1BulkPublishCommand = void 0;
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const CognitoSyncServiceException_1 = require("../models/CognitoSyncServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_restJson1BulkPublishCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {};
@@ -695,67 +697,31 @@ const deserializeAws_restJson1BulkPublishCommandError = async (output, context)
695
697
  switch (errorCode) {
696
698
  case "AlreadyStreamedException":
697
699
  case "com.amazonaws.cognitosync#AlreadyStreamedException":
698
- response = {
699
- ...(await deserializeAws_restJson1AlreadyStreamedExceptionResponse(parsedOutput, context)),
700
- name: errorCode,
701
- $metadata: deserializeMetadata(output),
702
- };
703
- break;
700
+ throw await deserializeAws_restJson1AlreadyStreamedExceptionResponse(parsedOutput, context);
704
701
  case "DuplicateRequestException":
705
702
  case "com.amazonaws.cognitosync#DuplicateRequestException":
706
- response = {
707
- ...(await deserializeAws_restJson1DuplicateRequestExceptionResponse(parsedOutput, context)),
708
- name: errorCode,
709
- $metadata: deserializeMetadata(output),
710
- };
711
- break;
703
+ throw await deserializeAws_restJson1DuplicateRequestExceptionResponse(parsedOutput, context);
712
704
  case "InternalErrorException":
713
705
  case "com.amazonaws.cognitosync#InternalErrorException":
714
- response = {
715
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
716
- name: errorCode,
717
- $metadata: deserializeMetadata(output),
718
- };
719
- break;
706
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
720
707
  case "InvalidParameterException":
721
708
  case "com.amazonaws.cognitosync#InvalidParameterException":
722
- response = {
723
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
724
- name: errorCode,
725
- $metadata: deserializeMetadata(output),
726
- };
727
- break;
709
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
728
710
  case "NotAuthorizedException":
729
711
  case "com.amazonaws.cognitosync#NotAuthorizedException":
730
- response = {
731
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
732
- name: errorCode,
733
- $metadata: deserializeMetadata(output),
734
- };
735
- break;
712
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
736
713
  case "ResourceNotFoundException":
737
714
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
738
- response = {
739
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
740
- name: errorCode,
741
- $metadata: deserializeMetadata(output),
742
- };
743
- break;
715
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
744
716
  default:
745
717
  const parsedBody = parsedOutput.body;
746
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
747
- response = {
748
- ...parsedBody,
749
- name: `${errorCode}`,
750
- message: parsedBody.message || parsedBody.Message || errorCode,
718
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
719
+ name: parsedBody.code || parsedBody.Code || errorCode,
751
720
  $fault: "client",
752
721
  $metadata: deserializeMetadata(output),
753
- };
722
+ });
723
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
754
724
  }
755
- const message = response.message || response.Message || errorCode;
756
- response.message = message;
757
- delete response.Message;
758
- return Promise.reject(Object.assign(new Error(message), response));
759
725
  };
760
726
  const deserializeAws_restJson1DeleteDatasetCommand = async (output, context) => {
761
727
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -783,67 +749,31 @@ const deserializeAws_restJson1DeleteDatasetCommandError = async (output, context
783
749
  switch (errorCode) {
784
750
  case "InternalErrorException":
785
751
  case "com.amazonaws.cognitosync#InternalErrorException":
786
- response = {
787
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
788
- name: errorCode,
789
- $metadata: deserializeMetadata(output),
790
- };
791
- break;
752
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
792
753
  case "InvalidParameterException":
793
754
  case "com.amazonaws.cognitosync#InvalidParameterException":
794
- response = {
795
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
796
- name: errorCode,
797
- $metadata: deserializeMetadata(output),
798
- };
799
- break;
755
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
800
756
  case "NotAuthorizedException":
801
757
  case "com.amazonaws.cognitosync#NotAuthorizedException":
802
- response = {
803
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
804
- name: errorCode,
805
- $metadata: deserializeMetadata(output),
806
- };
807
- break;
758
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
808
759
  case "ResourceConflictException":
809
760
  case "com.amazonaws.cognitosync#ResourceConflictException":
810
- response = {
811
- ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
812
- name: errorCode,
813
- $metadata: deserializeMetadata(output),
814
- };
815
- break;
761
+ throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
816
762
  case "ResourceNotFoundException":
817
763
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
818
- response = {
819
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
820
- name: errorCode,
821
- $metadata: deserializeMetadata(output),
822
- };
823
- break;
764
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
824
765
  case "TooManyRequestsException":
825
766
  case "com.amazonaws.cognitosync#TooManyRequestsException":
826
- response = {
827
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
828
- name: errorCode,
829
- $metadata: deserializeMetadata(output),
830
- };
831
- break;
767
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
832
768
  default:
833
769
  const parsedBody = parsedOutput.body;
834
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
835
- response = {
836
- ...parsedBody,
837
- name: `${errorCode}`,
838
- message: parsedBody.message || parsedBody.Message || errorCode,
770
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
771
+ name: parsedBody.code || parsedBody.Code || errorCode,
839
772
  $fault: "client",
840
773
  $metadata: deserializeMetadata(output),
841
- };
774
+ });
775
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
842
776
  }
843
- const message = response.message || response.Message || errorCode;
844
- response.message = message;
845
- delete response.Message;
846
- return Promise.reject(Object.assign(new Error(message), response));
847
777
  };
848
778
  const deserializeAws_restJson1DescribeDatasetCommand = async (output, context) => {
849
779
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -871,59 +801,28 @@ const deserializeAws_restJson1DescribeDatasetCommandError = async (output, conte
871
801
  switch (errorCode) {
872
802
  case "InternalErrorException":
873
803
  case "com.amazonaws.cognitosync#InternalErrorException":
874
- response = {
875
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
876
- name: errorCode,
877
- $metadata: deserializeMetadata(output),
878
- };
879
- break;
804
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
880
805
  case "InvalidParameterException":
881
806
  case "com.amazonaws.cognitosync#InvalidParameterException":
882
- response = {
883
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
884
- name: errorCode,
885
- $metadata: deserializeMetadata(output),
886
- };
887
- break;
807
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
888
808
  case "NotAuthorizedException":
889
809
  case "com.amazonaws.cognitosync#NotAuthorizedException":
890
- response = {
891
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
892
- name: errorCode,
893
- $metadata: deserializeMetadata(output),
894
- };
895
- break;
810
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
896
811
  case "ResourceNotFoundException":
897
812
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
898
- response = {
899
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
900
- name: errorCode,
901
- $metadata: deserializeMetadata(output),
902
- };
903
- break;
813
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
904
814
  case "TooManyRequestsException":
905
815
  case "com.amazonaws.cognitosync#TooManyRequestsException":
906
- response = {
907
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
908
- name: errorCode,
909
- $metadata: deserializeMetadata(output),
910
- };
911
- break;
816
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
912
817
  default:
913
818
  const parsedBody = parsedOutput.body;
914
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
915
- response = {
916
- ...parsedBody,
917
- name: `${errorCode}`,
918
- message: parsedBody.message || parsedBody.Message || errorCode,
819
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
820
+ name: parsedBody.code || parsedBody.Code || errorCode,
919
821
  $fault: "client",
920
822
  $metadata: deserializeMetadata(output),
921
- };
823
+ });
824
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
922
825
  }
923
- const message = response.message || response.Message || errorCode;
924
- response.message = message;
925
- delete response.Message;
926
- return Promise.reject(Object.assign(new Error(message), response));
927
826
  };
928
827
  const deserializeAws_restJson1DescribeIdentityPoolUsageCommand = async (output, context) => {
929
828
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -951,59 +850,28 @@ const deserializeAws_restJson1DescribeIdentityPoolUsageCommandError = async (out
951
850
  switch (errorCode) {
952
851
  case "InternalErrorException":
953
852
  case "com.amazonaws.cognitosync#InternalErrorException":
954
- response = {
955
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
956
- name: errorCode,
957
- $metadata: deserializeMetadata(output),
958
- };
959
- break;
853
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
960
854
  case "InvalidParameterException":
961
855
  case "com.amazonaws.cognitosync#InvalidParameterException":
962
- response = {
963
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
964
- name: errorCode,
965
- $metadata: deserializeMetadata(output),
966
- };
967
- break;
856
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
968
857
  case "NotAuthorizedException":
969
858
  case "com.amazonaws.cognitosync#NotAuthorizedException":
970
- response = {
971
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
972
- name: errorCode,
973
- $metadata: deserializeMetadata(output),
974
- };
975
- break;
859
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
976
860
  case "ResourceNotFoundException":
977
861
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
978
- response = {
979
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
980
- name: errorCode,
981
- $metadata: deserializeMetadata(output),
982
- };
983
- break;
862
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
984
863
  case "TooManyRequestsException":
985
864
  case "com.amazonaws.cognitosync#TooManyRequestsException":
986
- response = {
987
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
988
- name: errorCode,
989
- $metadata: deserializeMetadata(output),
990
- };
991
- break;
865
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
992
866
  default:
993
867
  const parsedBody = parsedOutput.body;
994
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
995
- response = {
996
- ...parsedBody,
997
- name: `${errorCode}`,
998
- message: parsedBody.message || parsedBody.Message || errorCode,
868
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
869
+ name: parsedBody.code || parsedBody.Code || errorCode,
999
870
  $fault: "client",
1000
871
  $metadata: deserializeMetadata(output),
1001
- };
872
+ });
873
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1002
874
  }
1003
- const message = response.message || response.Message || errorCode;
1004
- response.message = message;
1005
- delete response.Message;
1006
- return Promise.reject(Object.assign(new Error(message), response));
1007
875
  };
1008
876
  const deserializeAws_restJson1DescribeIdentityUsageCommand = async (output, context) => {
1009
877
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1031,59 +899,28 @@ const deserializeAws_restJson1DescribeIdentityUsageCommandError = async (output,
1031
899
  switch (errorCode) {
1032
900
  case "InternalErrorException":
1033
901
  case "com.amazonaws.cognitosync#InternalErrorException":
1034
- response = {
1035
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1036
- name: errorCode,
1037
- $metadata: deserializeMetadata(output),
1038
- };
1039
- break;
902
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1040
903
  case "InvalidParameterException":
1041
904
  case "com.amazonaws.cognitosync#InvalidParameterException":
1042
- response = {
1043
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1044
- name: errorCode,
1045
- $metadata: deserializeMetadata(output),
1046
- };
1047
- break;
905
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1048
906
  case "NotAuthorizedException":
1049
907
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1050
- response = {
1051
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1052
- name: errorCode,
1053
- $metadata: deserializeMetadata(output),
1054
- };
1055
- break;
908
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1056
909
  case "ResourceNotFoundException":
1057
910
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1058
- response = {
1059
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1060
- name: errorCode,
1061
- $metadata: deserializeMetadata(output),
1062
- };
1063
- break;
911
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1064
912
  case "TooManyRequestsException":
1065
913
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1066
- response = {
1067
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1068
- name: errorCode,
1069
- $metadata: deserializeMetadata(output),
1070
- };
1071
- break;
914
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1072
915
  default:
1073
916
  const parsedBody = parsedOutput.body;
1074
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1075
- response = {
1076
- ...parsedBody,
1077
- name: `${errorCode}`,
1078
- message: parsedBody.message || parsedBody.Message || errorCode,
917
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
918
+ name: parsedBody.code || parsedBody.Code || errorCode,
1079
919
  $fault: "client",
1080
920
  $metadata: deserializeMetadata(output),
1081
- };
921
+ });
922
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1082
923
  }
1083
- const message = response.message || response.Message || errorCode;
1084
- response.message = message;
1085
- delete response.Message;
1086
- return Promise.reject(Object.assign(new Error(message), response));
1087
924
  };
1088
925
  const deserializeAws_restJson1GetBulkPublishDetailsCommand = async (output, context) => {
1089
926
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1127,51 +964,25 @@ const deserializeAws_restJson1GetBulkPublishDetailsCommandError = async (output,
1127
964
  switch (errorCode) {
1128
965
  case "InternalErrorException":
1129
966
  case "com.amazonaws.cognitosync#InternalErrorException":
1130
- response = {
1131
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1132
- name: errorCode,
1133
- $metadata: deserializeMetadata(output),
1134
- };
1135
- break;
967
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1136
968
  case "InvalidParameterException":
1137
969
  case "com.amazonaws.cognitosync#InvalidParameterException":
1138
- response = {
1139
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1140
- name: errorCode,
1141
- $metadata: deserializeMetadata(output),
1142
- };
1143
- break;
970
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1144
971
  case "NotAuthorizedException":
1145
972
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1146
- response = {
1147
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1148
- name: errorCode,
1149
- $metadata: deserializeMetadata(output),
1150
- };
1151
- break;
973
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1152
974
  case "ResourceNotFoundException":
1153
975
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1154
- response = {
1155
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1156
- name: errorCode,
1157
- $metadata: deserializeMetadata(output),
1158
- };
1159
- break;
976
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1160
977
  default:
1161
978
  const parsedBody = parsedOutput.body;
1162
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1163
- response = {
1164
- ...parsedBody,
1165
- name: `${errorCode}`,
1166
- message: parsedBody.message || parsedBody.Message || errorCode,
979
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
980
+ name: parsedBody.code || parsedBody.Code || errorCode,
1167
981
  $fault: "client",
1168
982
  $metadata: deserializeMetadata(output),
1169
- };
983
+ });
984
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1170
985
  }
1171
- const message = response.message || response.Message || errorCode;
1172
- response.message = message;
1173
- delete response.Message;
1174
- return Promise.reject(Object.assign(new Error(message), response));
1175
986
  };
1176
987
  const deserializeAws_restJson1GetCognitoEventsCommand = async (output, context) => {
1177
988
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1199,59 +1010,28 @@ const deserializeAws_restJson1GetCognitoEventsCommandError = async (output, cont
1199
1010
  switch (errorCode) {
1200
1011
  case "InternalErrorException":
1201
1012
  case "com.amazonaws.cognitosync#InternalErrorException":
1202
- response = {
1203
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1204
- name: errorCode,
1205
- $metadata: deserializeMetadata(output),
1206
- };
1207
- break;
1013
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1208
1014
  case "InvalidParameterException":
1209
1015
  case "com.amazonaws.cognitosync#InvalidParameterException":
1210
- response = {
1211
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1212
- name: errorCode,
1213
- $metadata: deserializeMetadata(output),
1214
- };
1215
- break;
1016
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1216
1017
  case "NotAuthorizedException":
1217
1018
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1218
- response = {
1219
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1220
- name: errorCode,
1221
- $metadata: deserializeMetadata(output),
1222
- };
1223
- break;
1019
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1224
1020
  case "ResourceNotFoundException":
1225
1021
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1226
- response = {
1227
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1228
- name: errorCode,
1229
- $metadata: deserializeMetadata(output),
1230
- };
1231
- break;
1022
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1232
1023
  case "TooManyRequestsException":
1233
1024
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1234
- response = {
1235
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1236
- name: errorCode,
1237
- $metadata: deserializeMetadata(output),
1238
- };
1239
- break;
1025
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1240
1026
  default:
1241
1027
  const parsedBody = parsedOutput.body;
1242
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1243
- response = {
1244
- ...parsedBody,
1245
- name: `${errorCode}`,
1246
- message: parsedBody.message || parsedBody.Message || errorCode,
1028
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1029
+ name: parsedBody.code || parsedBody.Code || errorCode,
1247
1030
  $fault: "client",
1248
1031
  $metadata: deserializeMetadata(output),
1249
- };
1032
+ });
1033
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1250
1034
  }
1251
- const message = response.message || response.Message || errorCode;
1252
- response.message = message;
1253
- delete response.Message;
1254
- return Promise.reject(Object.assign(new Error(message), response));
1255
1035
  };
1256
1036
  const deserializeAws_restJson1GetIdentityPoolConfigurationCommand = async (output, context) => {
1257
1037
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1287,59 +1067,28 @@ const deserializeAws_restJson1GetIdentityPoolConfigurationCommandError = async (
1287
1067
  switch (errorCode) {
1288
1068
  case "InternalErrorException":
1289
1069
  case "com.amazonaws.cognitosync#InternalErrorException":
1290
- response = {
1291
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1292
- name: errorCode,
1293
- $metadata: deserializeMetadata(output),
1294
- };
1295
- break;
1070
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1296
1071
  case "InvalidParameterException":
1297
1072
  case "com.amazonaws.cognitosync#InvalidParameterException":
1298
- response = {
1299
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1300
- name: errorCode,
1301
- $metadata: deserializeMetadata(output),
1302
- };
1303
- break;
1073
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1304
1074
  case "NotAuthorizedException":
1305
1075
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1306
- response = {
1307
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1308
- name: errorCode,
1309
- $metadata: deserializeMetadata(output),
1310
- };
1311
- break;
1076
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1312
1077
  case "ResourceNotFoundException":
1313
1078
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1314
- response = {
1315
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1316
- name: errorCode,
1317
- $metadata: deserializeMetadata(output),
1318
- };
1319
- break;
1079
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1320
1080
  case "TooManyRequestsException":
1321
1081
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1322
- response = {
1323
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1324
- name: errorCode,
1325
- $metadata: deserializeMetadata(output),
1326
- };
1327
- break;
1082
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1328
1083
  default:
1329
1084
  const parsedBody = parsedOutput.body;
1330
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1331
- response = {
1332
- ...parsedBody,
1333
- name: `${errorCode}`,
1334
- message: parsedBody.message || parsedBody.Message || errorCode,
1085
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1086
+ name: parsedBody.code || parsedBody.Code || errorCode,
1335
1087
  $fault: "client",
1336
1088
  $metadata: deserializeMetadata(output),
1337
- };
1089
+ });
1090
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1338
1091
  }
1339
- const message = response.message || response.Message || errorCode;
1340
- response.message = message;
1341
- delete response.Message;
1342
- return Promise.reject(Object.assign(new Error(message), response));
1343
1092
  };
1344
1093
  const deserializeAws_restJson1ListDatasetsCommand = async (output, context) => {
1345
1094
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1375,51 +1124,25 @@ const deserializeAws_restJson1ListDatasetsCommandError = async (output, context)
1375
1124
  switch (errorCode) {
1376
1125
  case "InternalErrorException":
1377
1126
  case "com.amazonaws.cognitosync#InternalErrorException":
1378
- response = {
1379
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1380
- name: errorCode,
1381
- $metadata: deserializeMetadata(output),
1382
- };
1383
- break;
1127
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1384
1128
  case "InvalidParameterException":
1385
1129
  case "com.amazonaws.cognitosync#InvalidParameterException":
1386
- response = {
1387
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1388
- name: errorCode,
1389
- $metadata: deserializeMetadata(output),
1390
- };
1391
- break;
1130
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1392
1131
  case "NotAuthorizedException":
1393
1132
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1394
- response = {
1395
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1396
- name: errorCode,
1397
- $metadata: deserializeMetadata(output),
1398
- };
1399
- break;
1133
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1400
1134
  case "TooManyRequestsException":
1401
1135
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1402
- response = {
1403
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1404
- name: errorCode,
1405
- $metadata: deserializeMetadata(output),
1406
- };
1407
- break;
1136
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1408
1137
  default:
1409
1138
  const parsedBody = parsedOutput.body;
1410
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1411
- response = {
1412
- ...parsedBody,
1413
- name: `${errorCode}`,
1414
- message: parsedBody.message || parsedBody.Message || errorCode,
1139
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1140
+ name: parsedBody.code || parsedBody.Code || errorCode,
1415
1141
  $fault: "client",
1416
1142
  $metadata: deserializeMetadata(output),
1417
- };
1143
+ });
1144
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1418
1145
  }
1419
- const message = response.message || response.Message || errorCode;
1420
- response.message = message;
1421
- delete response.Message;
1422
- return Promise.reject(Object.assign(new Error(message), response));
1423
1146
  };
1424
1147
  const deserializeAws_restJson1ListIdentityPoolUsageCommand = async (output, context) => {
1425
1148
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1459,51 +1182,25 @@ const deserializeAws_restJson1ListIdentityPoolUsageCommandError = async (output,
1459
1182
  switch (errorCode) {
1460
1183
  case "InternalErrorException":
1461
1184
  case "com.amazonaws.cognitosync#InternalErrorException":
1462
- response = {
1463
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1464
- name: errorCode,
1465
- $metadata: deserializeMetadata(output),
1466
- };
1467
- break;
1185
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1468
1186
  case "InvalidParameterException":
1469
1187
  case "com.amazonaws.cognitosync#InvalidParameterException":
1470
- response = {
1471
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1472
- name: errorCode,
1473
- $metadata: deserializeMetadata(output),
1474
- };
1475
- break;
1188
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1476
1189
  case "NotAuthorizedException":
1477
1190
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1478
- response = {
1479
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1480
- name: errorCode,
1481
- $metadata: deserializeMetadata(output),
1482
- };
1483
- break;
1191
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1484
1192
  case "TooManyRequestsException":
1485
1193
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1486
- response = {
1487
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1488
- name: errorCode,
1489
- $metadata: deserializeMetadata(output),
1490
- };
1491
- break;
1194
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1492
1195
  default:
1493
1196
  const parsedBody = parsedOutput.body;
1494
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1495
- response = {
1496
- ...parsedBody,
1497
- name: `${errorCode}`,
1498
- message: parsedBody.message || parsedBody.Message || errorCode,
1197
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1198
+ name: parsedBody.code || parsedBody.Code || errorCode,
1499
1199
  $fault: "client",
1500
1200
  $metadata: deserializeMetadata(output),
1501
- };
1201
+ });
1202
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1502
1203
  }
1503
- const message = response.message || response.Message || errorCode;
1504
- response.message = message;
1505
- delete response.Message;
1506
- return Promise.reject(Object.assign(new Error(message), response));
1507
1204
  };
1508
1205
  const deserializeAws_restJson1ListRecordsCommand = async (output, context) => {
1509
1206
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1563,51 +1260,25 @@ const deserializeAws_restJson1ListRecordsCommandError = async (output, context)
1563
1260
  switch (errorCode) {
1564
1261
  case "InternalErrorException":
1565
1262
  case "com.amazonaws.cognitosync#InternalErrorException":
1566
- response = {
1567
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1568
- name: errorCode,
1569
- $metadata: deserializeMetadata(output),
1570
- };
1571
- break;
1263
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1572
1264
  case "InvalidParameterException":
1573
1265
  case "com.amazonaws.cognitosync#InvalidParameterException":
1574
- response = {
1575
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1576
- name: errorCode,
1577
- $metadata: deserializeMetadata(output),
1578
- };
1579
- break;
1266
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1580
1267
  case "NotAuthorizedException":
1581
1268
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1582
- response = {
1583
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1584
- name: errorCode,
1585
- $metadata: deserializeMetadata(output),
1586
- };
1587
- break;
1269
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1588
1270
  case "TooManyRequestsException":
1589
1271
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1590
- response = {
1591
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1592
- name: errorCode,
1593
- $metadata: deserializeMetadata(output),
1594
- };
1595
- break;
1272
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1596
1273
  default:
1597
1274
  const parsedBody = parsedOutput.body;
1598
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1599
- response = {
1600
- ...parsedBody,
1601
- name: `${errorCode}`,
1602
- message: parsedBody.message || parsedBody.Message || errorCode,
1275
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1276
+ name: parsedBody.code || parsedBody.Code || errorCode,
1603
1277
  $fault: "client",
1604
1278
  $metadata: deserializeMetadata(output),
1605
- };
1279
+ });
1280
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1606
1281
  }
1607
- const message = response.message || response.Message || errorCode;
1608
- response.message = message;
1609
- delete response.Message;
1610
- return Promise.reject(Object.assign(new Error(message), response));
1611
1282
  };
1612
1283
  const deserializeAws_restJson1RegisterDeviceCommand = async (output, context) => {
1613
1284
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1635,67 +1306,31 @@ const deserializeAws_restJson1RegisterDeviceCommandError = async (output, contex
1635
1306
  switch (errorCode) {
1636
1307
  case "InternalErrorException":
1637
1308
  case "com.amazonaws.cognitosync#InternalErrorException":
1638
- response = {
1639
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1640
- name: errorCode,
1641
- $metadata: deserializeMetadata(output),
1642
- };
1643
- break;
1309
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1644
1310
  case "InvalidConfigurationException":
1645
1311
  case "com.amazonaws.cognitosync#InvalidConfigurationException":
1646
- response = {
1647
- ...(await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)),
1648
- name: errorCode,
1649
- $metadata: deserializeMetadata(output),
1650
- };
1651
- break;
1312
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
1652
1313
  case "InvalidParameterException":
1653
1314
  case "com.amazonaws.cognitosync#InvalidParameterException":
1654
- response = {
1655
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1656
- name: errorCode,
1657
- $metadata: deserializeMetadata(output),
1658
- };
1659
- break;
1315
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1660
1316
  case "NotAuthorizedException":
1661
1317
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1662
- response = {
1663
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1664
- name: errorCode,
1665
- $metadata: deserializeMetadata(output),
1666
- };
1667
- break;
1318
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1668
1319
  case "ResourceNotFoundException":
1669
1320
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1670
- response = {
1671
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1672
- name: errorCode,
1673
- $metadata: deserializeMetadata(output),
1674
- };
1675
- break;
1321
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1676
1322
  case "TooManyRequestsException":
1677
1323
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1678
- response = {
1679
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1680
- name: errorCode,
1681
- $metadata: deserializeMetadata(output),
1682
- };
1683
- break;
1324
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1684
1325
  default:
1685
1326
  const parsedBody = parsedOutput.body;
1686
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1687
- response = {
1688
- ...parsedBody,
1689
- name: `${errorCode}`,
1690
- message: parsedBody.message || parsedBody.Message || errorCode,
1327
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1328
+ name: parsedBody.code || parsedBody.Code || errorCode,
1691
1329
  $fault: "client",
1692
1330
  $metadata: deserializeMetadata(output),
1693
- };
1331
+ });
1332
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1694
1333
  }
1695
- const message = response.message || response.Message || errorCode;
1696
- response.message = message;
1697
- delete response.Message;
1698
- return Promise.reject(Object.assign(new Error(message), response));
1699
1334
  };
1700
1335
  const deserializeAws_restJson1SetCognitoEventsCommand = async (output, context) => {
1701
1336
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1719,59 +1354,28 @@ const deserializeAws_restJson1SetCognitoEventsCommandError = async (output, cont
1719
1354
  switch (errorCode) {
1720
1355
  case "InternalErrorException":
1721
1356
  case "com.amazonaws.cognitosync#InternalErrorException":
1722
- response = {
1723
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1724
- name: errorCode,
1725
- $metadata: deserializeMetadata(output),
1726
- };
1727
- break;
1357
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1728
1358
  case "InvalidParameterException":
1729
1359
  case "com.amazonaws.cognitosync#InvalidParameterException":
1730
- response = {
1731
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1732
- name: errorCode,
1733
- $metadata: deserializeMetadata(output),
1734
- };
1735
- break;
1360
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1736
1361
  case "NotAuthorizedException":
1737
1362
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1738
- response = {
1739
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1740
- name: errorCode,
1741
- $metadata: deserializeMetadata(output),
1742
- };
1743
- break;
1363
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1744
1364
  case "ResourceNotFoundException":
1745
1365
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1746
- response = {
1747
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1748
- name: errorCode,
1749
- $metadata: deserializeMetadata(output),
1750
- };
1751
- break;
1366
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1752
1367
  case "TooManyRequestsException":
1753
1368
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1754
- response = {
1755
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1756
- name: errorCode,
1757
- $metadata: deserializeMetadata(output),
1758
- };
1759
- break;
1369
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1760
1370
  default:
1761
1371
  const parsedBody = parsedOutput.body;
1762
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1763
- response = {
1764
- ...parsedBody,
1765
- name: `${errorCode}`,
1766
- message: parsedBody.message || parsedBody.Message || errorCode,
1372
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1373
+ name: parsedBody.code || parsedBody.Code || errorCode,
1767
1374
  $fault: "client",
1768
1375
  $metadata: deserializeMetadata(output),
1769
- };
1376
+ });
1377
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1770
1378
  }
1771
- const message = response.message || response.Message || errorCode;
1772
- response.message = message;
1773
- delete response.Message;
1774
- return Promise.reject(Object.assign(new Error(message), response));
1775
1379
  };
1776
1380
  const deserializeAws_restJson1SetIdentityPoolConfigurationCommand = async (output, context) => {
1777
1381
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1807,67 +1411,31 @@ const deserializeAws_restJson1SetIdentityPoolConfigurationCommandError = async (
1807
1411
  switch (errorCode) {
1808
1412
  case "ConcurrentModificationException":
1809
1413
  case "com.amazonaws.cognitosync#ConcurrentModificationException":
1810
- response = {
1811
- ...(await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context)),
1812
- name: errorCode,
1813
- $metadata: deserializeMetadata(output),
1814
- };
1815
- break;
1414
+ throw await deserializeAws_restJson1ConcurrentModificationExceptionResponse(parsedOutput, context);
1816
1415
  case "InternalErrorException":
1817
1416
  case "com.amazonaws.cognitosync#InternalErrorException":
1818
- response = {
1819
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1820
- name: errorCode,
1821
- $metadata: deserializeMetadata(output),
1822
- };
1823
- break;
1417
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1824
1418
  case "InvalidParameterException":
1825
1419
  case "com.amazonaws.cognitosync#InvalidParameterException":
1826
- response = {
1827
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1828
- name: errorCode,
1829
- $metadata: deserializeMetadata(output),
1830
- };
1831
- break;
1420
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1832
1421
  case "NotAuthorizedException":
1833
1422
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1834
- response = {
1835
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1836
- name: errorCode,
1837
- $metadata: deserializeMetadata(output),
1838
- };
1839
- break;
1423
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1840
1424
  case "ResourceNotFoundException":
1841
1425
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1842
- response = {
1843
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1844
- name: errorCode,
1845
- $metadata: deserializeMetadata(output),
1846
- };
1847
- break;
1426
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1848
1427
  case "TooManyRequestsException":
1849
1428
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1850
- response = {
1851
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1852
- name: errorCode,
1853
- $metadata: deserializeMetadata(output),
1854
- };
1855
- break;
1429
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1856
1430
  default:
1857
1431
  const parsedBody = parsedOutput.body;
1858
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1859
- response = {
1860
- ...parsedBody,
1861
- name: `${errorCode}`,
1862
- message: parsedBody.message || parsedBody.Message || errorCode,
1432
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1433
+ name: parsedBody.code || parsedBody.Code || errorCode,
1863
1434
  $fault: "client",
1864
1435
  $metadata: deserializeMetadata(output),
1865
- };
1436
+ });
1437
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1866
1438
  }
1867
- const message = response.message || response.Message || errorCode;
1868
- response.message = message;
1869
- delete response.Message;
1870
- return Promise.reject(Object.assign(new Error(message), response));
1871
1439
  };
1872
1440
  const deserializeAws_restJson1SubscribeToDatasetCommand = async (output, context) => {
1873
1441
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1891,67 +1459,31 @@ const deserializeAws_restJson1SubscribeToDatasetCommandError = async (output, co
1891
1459
  switch (errorCode) {
1892
1460
  case "InternalErrorException":
1893
1461
  case "com.amazonaws.cognitosync#InternalErrorException":
1894
- response = {
1895
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1896
- name: errorCode,
1897
- $metadata: deserializeMetadata(output),
1898
- };
1899
- break;
1462
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1900
1463
  case "InvalidConfigurationException":
1901
1464
  case "com.amazonaws.cognitosync#InvalidConfigurationException":
1902
- response = {
1903
- ...(await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)),
1904
- name: errorCode,
1905
- $metadata: deserializeMetadata(output),
1906
- };
1907
- break;
1465
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
1908
1466
  case "InvalidParameterException":
1909
1467
  case "com.amazonaws.cognitosync#InvalidParameterException":
1910
- response = {
1911
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1912
- name: errorCode,
1913
- $metadata: deserializeMetadata(output),
1914
- };
1915
- break;
1468
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
1916
1469
  case "NotAuthorizedException":
1917
1470
  case "com.amazonaws.cognitosync#NotAuthorizedException":
1918
- response = {
1919
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
1920
- name: errorCode,
1921
- $metadata: deserializeMetadata(output),
1922
- };
1923
- break;
1471
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
1924
1472
  case "ResourceNotFoundException":
1925
1473
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
1926
- response = {
1927
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1928
- name: errorCode,
1929
- $metadata: deserializeMetadata(output),
1930
- };
1931
- break;
1474
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1932
1475
  case "TooManyRequestsException":
1933
1476
  case "com.amazonaws.cognitosync#TooManyRequestsException":
1934
- response = {
1935
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1936
- name: errorCode,
1937
- $metadata: deserializeMetadata(output),
1938
- };
1939
- break;
1477
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1940
1478
  default:
1941
1479
  const parsedBody = parsedOutput.body;
1942
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1943
- response = {
1944
- ...parsedBody,
1945
- name: `${errorCode}`,
1946
- message: parsedBody.message || parsedBody.Message || errorCode,
1480
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1481
+ name: parsedBody.code || parsedBody.Code || errorCode,
1947
1482
  $fault: "client",
1948
1483
  $metadata: deserializeMetadata(output),
1949
- };
1484
+ });
1485
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1950
1486
  }
1951
- const message = response.message || response.Message || errorCode;
1952
- response.message = message;
1953
- delete response.Message;
1954
- return Promise.reject(Object.assign(new Error(message), response));
1955
1487
  };
1956
1488
  const deserializeAws_restJson1UnsubscribeFromDatasetCommand = async (output, context) => {
1957
1489
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1975,67 +1507,31 @@ const deserializeAws_restJson1UnsubscribeFromDatasetCommandError = async (output
1975
1507
  switch (errorCode) {
1976
1508
  case "InternalErrorException":
1977
1509
  case "com.amazonaws.cognitosync#InternalErrorException":
1978
- response = {
1979
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
1980
- name: errorCode,
1981
- $metadata: deserializeMetadata(output),
1982
- };
1983
- break;
1510
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
1984
1511
  case "InvalidConfigurationException":
1985
1512
  case "com.amazonaws.cognitosync#InvalidConfigurationException":
1986
- response = {
1987
- ...(await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context)),
1988
- name: errorCode,
1989
- $metadata: deserializeMetadata(output),
1990
- };
1991
- break;
1513
+ throw await deserializeAws_restJson1InvalidConfigurationExceptionResponse(parsedOutput, context);
1992
1514
  case "InvalidParameterException":
1993
1515
  case "com.amazonaws.cognitosync#InvalidParameterException":
1994
- response = {
1995
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
1996
- name: errorCode,
1997
- $metadata: deserializeMetadata(output),
1998
- };
1999
- break;
1516
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
2000
1517
  case "NotAuthorizedException":
2001
1518
  case "com.amazonaws.cognitosync#NotAuthorizedException":
2002
- response = {
2003
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
2004
- name: errorCode,
2005
- $metadata: deserializeMetadata(output),
2006
- };
2007
- break;
1519
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
2008
1520
  case "ResourceNotFoundException":
2009
1521
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
2010
- response = {
2011
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2012
- name: errorCode,
2013
- $metadata: deserializeMetadata(output),
2014
- };
2015
- break;
1522
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2016
1523
  case "TooManyRequestsException":
2017
1524
  case "com.amazonaws.cognitosync#TooManyRequestsException":
2018
- response = {
2019
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2020
- name: errorCode,
2021
- $metadata: deserializeMetadata(output),
2022
- };
2023
- break;
1525
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2024
1526
  default:
2025
1527
  const parsedBody = parsedOutput.body;
2026
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2027
- response = {
2028
- ...parsedBody,
2029
- name: `${errorCode}`,
2030
- message: parsedBody.message || parsedBody.Message || errorCode,
1528
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1529
+ name: parsedBody.code || parsedBody.Code || errorCode,
2031
1530
  $fault: "client",
2032
1531
  $metadata: deserializeMetadata(output),
2033
- };
1532
+ });
1533
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2034
1534
  }
2035
- const message = response.message || response.Message || errorCode;
2036
- response.message = message;
2037
- delete response.Message;
2038
- return Promise.reject(Object.assign(new Error(message), response));
2039
1535
  };
2040
1536
  const deserializeAws_restJson1UpdateRecordsCommand = async (output, context) => {
2041
1537
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2063,260 +1559,196 @@ const deserializeAws_restJson1UpdateRecordsCommandError = async (output, context
2063
1559
  switch (errorCode) {
2064
1560
  case "InternalErrorException":
2065
1561
  case "com.amazonaws.cognitosync#InternalErrorException":
2066
- response = {
2067
- ...(await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context)),
2068
- name: errorCode,
2069
- $metadata: deserializeMetadata(output),
2070
- };
2071
- break;
1562
+ throw await deserializeAws_restJson1InternalErrorExceptionResponse(parsedOutput, context);
2072
1563
  case "InvalidLambdaFunctionOutputException":
2073
1564
  case "com.amazonaws.cognitosync#InvalidLambdaFunctionOutputException":
2074
- response = {
2075
- ...(await deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse(parsedOutput, context)),
2076
- name: errorCode,
2077
- $metadata: deserializeMetadata(output),
2078
- };
2079
- break;
1565
+ throw await deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse(parsedOutput, context);
2080
1566
  case "InvalidParameterException":
2081
1567
  case "com.amazonaws.cognitosync#InvalidParameterException":
2082
- response = {
2083
- ...(await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context)),
2084
- name: errorCode,
2085
- $metadata: deserializeMetadata(output),
2086
- };
2087
- break;
1568
+ throw await deserializeAws_restJson1InvalidParameterExceptionResponse(parsedOutput, context);
2088
1569
  case "LambdaThrottledException":
2089
1570
  case "com.amazonaws.cognitosync#LambdaThrottledException":
2090
- response = {
2091
- ...(await deserializeAws_restJson1LambdaThrottledExceptionResponse(parsedOutput, context)),
2092
- name: errorCode,
2093
- $metadata: deserializeMetadata(output),
2094
- };
2095
- break;
1571
+ throw await deserializeAws_restJson1LambdaThrottledExceptionResponse(parsedOutput, context);
2096
1572
  case "LimitExceededException":
2097
1573
  case "com.amazonaws.cognitosync#LimitExceededException":
2098
- response = {
2099
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2100
- name: errorCode,
2101
- $metadata: deserializeMetadata(output),
2102
- };
2103
- break;
1574
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2104
1575
  case "NotAuthorizedException":
2105
1576
  case "com.amazonaws.cognitosync#NotAuthorizedException":
2106
- response = {
2107
- ...(await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context)),
2108
- name: errorCode,
2109
- $metadata: deserializeMetadata(output),
2110
- };
2111
- break;
1577
+ throw await deserializeAws_restJson1NotAuthorizedExceptionResponse(parsedOutput, context);
2112
1578
  case "ResourceConflictException":
2113
1579
  case "com.amazonaws.cognitosync#ResourceConflictException":
2114
- response = {
2115
- ...(await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context)),
2116
- name: errorCode,
2117
- $metadata: deserializeMetadata(output),
2118
- };
2119
- break;
1580
+ throw await deserializeAws_restJson1ResourceConflictExceptionResponse(parsedOutput, context);
2120
1581
  case "ResourceNotFoundException":
2121
1582
  case "com.amazonaws.cognitosync#ResourceNotFoundException":
2122
- response = {
2123
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2124
- name: errorCode,
2125
- $metadata: deserializeMetadata(output),
2126
- };
2127
- break;
1583
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2128
1584
  case "TooManyRequestsException":
2129
1585
  case "com.amazonaws.cognitosync#TooManyRequestsException":
2130
- response = {
2131
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2132
- name: errorCode,
2133
- $metadata: deserializeMetadata(output),
2134
- };
2135
- break;
1586
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2136
1587
  default:
2137
1588
  const parsedBody = parsedOutput.body;
2138
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2139
- response = {
2140
- ...parsedBody,
2141
- name: `${errorCode}`,
2142
- message: parsedBody.message || parsedBody.Message || errorCode,
1589
+ response = new CognitoSyncServiceException_1.CognitoSyncServiceException({
1590
+ name: parsedBody.code || parsedBody.Code || errorCode,
2143
1591
  $fault: "client",
2144
1592
  $metadata: deserializeMetadata(output),
2145
- };
1593
+ });
1594
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2146
1595
  }
2147
- const message = response.message || response.Message || errorCode;
2148
- response.message = message;
2149
- delete response.Message;
2150
- return Promise.reject(Object.assign(new Error(message), response));
2151
1596
  };
2152
1597
  const deserializeAws_restJson1AlreadyStreamedExceptionResponse = async (parsedOutput, context) => {
2153
- const contents = {
2154
- name: "AlreadyStreamedException",
2155
- $fault: "client",
2156
- $metadata: deserializeMetadata(parsedOutput),
2157
- message: undefined,
2158
- };
1598
+ const contents = {};
2159
1599
  const data = parsedOutput.body;
2160
1600
  if (data.message !== undefined && data.message !== null) {
2161
1601
  contents.message = smithy_client_1.expectString(data.message);
2162
1602
  }
2163
- return contents;
1603
+ const exception = new models_0_1.AlreadyStreamedException({
1604
+ $metadata: deserializeMetadata(parsedOutput),
1605
+ ...contents,
1606
+ });
1607
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2164
1608
  };
2165
1609
  const deserializeAws_restJson1ConcurrentModificationExceptionResponse = async (parsedOutput, context) => {
2166
- const contents = {
2167
- name: "ConcurrentModificationException",
2168
- $fault: "client",
2169
- $metadata: deserializeMetadata(parsedOutput),
2170
- message: undefined,
2171
- };
1610
+ const contents = {};
2172
1611
  const data = parsedOutput.body;
2173
1612
  if (data.message !== undefined && data.message !== null) {
2174
1613
  contents.message = smithy_client_1.expectString(data.message);
2175
1614
  }
2176
- return contents;
1615
+ const exception = new models_0_1.ConcurrentModificationException({
1616
+ $metadata: deserializeMetadata(parsedOutput),
1617
+ ...contents,
1618
+ });
1619
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2177
1620
  };
2178
1621
  const deserializeAws_restJson1DuplicateRequestExceptionResponse = async (parsedOutput, context) => {
2179
- const contents = {
2180
- name: "DuplicateRequestException",
2181
- $fault: "client",
2182
- $metadata: deserializeMetadata(parsedOutput),
2183
- message: undefined,
2184
- };
1622
+ const contents = {};
2185
1623
  const data = parsedOutput.body;
2186
1624
  if (data.message !== undefined && data.message !== null) {
2187
1625
  contents.message = smithy_client_1.expectString(data.message);
2188
1626
  }
2189
- return contents;
1627
+ const exception = new models_0_1.DuplicateRequestException({
1628
+ $metadata: deserializeMetadata(parsedOutput),
1629
+ ...contents,
1630
+ });
1631
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2190
1632
  };
2191
1633
  const deserializeAws_restJson1InternalErrorExceptionResponse = async (parsedOutput, context) => {
2192
- const contents = {
2193
- name: "InternalErrorException",
2194
- $fault: "server",
2195
- $metadata: deserializeMetadata(parsedOutput),
2196
- message: undefined,
2197
- };
1634
+ const contents = {};
2198
1635
  const data = parsedOutput.body;
2199
1636
  if (data.message !== undefined && data.message !== null) {
2200
1637
  contents.message = smithy_client_1.expectString(data.message);
2201
1638
  }
2202
- return contents;
1639
+ const exception = new models_0_1.InternalErrorException({
1640
+ $metadata: deserializeMetadata(parsedOutput),
1641
+ ...contents,
1642
+ });
1643
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2203
1644
  };
2204
1645
  const deserializeAws_restJson1InvalidConfigurationExceptionResponse = async (parsedOutput, context) => {
2205
- const contents = {
2206
- name: "InvalidConfigurationException",
2207
- $fault: "client",
2208
- $metadata: deserializeMetadata(parsedOutput),
2209
- message: undefined,
2210
- };
1646
+ const contents = {};
2211
1647
  const data = parsedOutput.body;
2212
1648
  if (data.message !== undefined && data.message !== null) {
2213
1649
  contents.message = smithy_client_1.expectString(data.message);
2214
1650
  }
2215
- return contents;
1651
+ const exception = new models_0_1.InvalidConfigurationException({
1652
+ $metadata: deserializeMetadata(parsedOutput),
1653
+ ...contents,
1654
+ });
1655
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2216
1656
  };
2217
1657
  const deserializeAws_restJson1InvalidLambdaFunctionOutputExceptionResponse = async (parsedOutput, context) => {
2218
- const contents = {
2219
- name: "InvalidLambdaFunctionOutputException",
2220
- $fault: "client",
2221
- $metadata: deserializeMetadata(parsedOutput),
2222
- message: undefined,
2223
- };
1658
+ const contents = {};
2224
1659
  const data = parsedOutput.body;
2225
1660
  if (data.message !== undefined && data.message !== null) {
2226
1661
  contents.message = smithy_client_1.expectString(data.message);
2227
1662
  }
2228
- return contents;
1663
+ const exception = new models_0_1.InvalidLambdaFunctionOutputException({
1664
+ $metadata: deserializeMetadata(parsedOutput),
1665
+ ...contents,
1666
+ });
1667
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2229
1668
  };
2230
1669
  const deserializeAws_restJson1InvalidParameterExceptionResponse = async (parsedOutput, context) => {
2231
- const contents = {
2232
- name: "InvalidParameterException",
2233
- $fault: "client",
2234
- $metadata: deserializeMetadata(parsedOutput),
2235
- message: undefined,
2236
- };
1670
+ const contents = {};
2237
1671
  const data = parsedOutput.body;
2238
1672
  if (data.message !== undefined && data.message !== null) {
2239
1673
  contents.message = smithy_client_1.expectString(data.message);
2240
1674
  }
2241
- return contents;
1675
+ const exception = new models_0_1.InvalidParameterException({
1676
+ $metadata: deserializeMetadata(parsedOutput),
1677
+ ...contents,
1678
+ });
1679
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2242
1680
  };
2243
1681
  const deserializeAws_restJson1LambdaThrottledExceptionResponse = async (parsedOutput, context) => {
2244
- const contents = {
2245
- name: "LambdaThrottledException",
2246
- $fault: "client",
2247
- $metadata: deserializeMetadata(parsedOutput),
2248
- message: undefined,
2249
- };
1682
+ const contents = {};
2250
1683
  const data = parsedOutput.body;
2251
1684
  if (data.message !== undefined && data.message !== null) {
2252
1685
  contents.message = smithy_client_1.expectString(data.message);
2253
1686
  }
2254
- return contents;
1687
+ const exception = new models_0_1.LambdaThrottledException({
1688
+ $metadata: deserializeMetadata(parsedOutput),
1689
+ ...contents,
1690
+ });
1691
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2255
1692
  };
2256
1693
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
2257
- const contents = {
2258
- name: "LimitExceededException",
2259
- $fault: "client",
2260
- $metadata: deserializeMetadata(parsedOutput),
2261
- message: undefined,
2262
- };
1694
+ const contents = {};
2263
1695
  const data = parsedOutput.body;
2264
1696
  if (data.message !== undefined && data.message !== null) {
2265
1697
  contents.message = smithy_client_1.expectString(data.message);
2266
1698
  }
2267
- return contents;
1699
+ const exception = new models_0_1.LimitExceededException({
1700
+ $metadata: deserializeMetadata(parsedOutput),
1701
+ ...contents,
1702
+ });
1703
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2268
1704
  };
2269
1705
  const deserializeAws_restJson1NotAuthorizedExceptionResponse = async (parsedOutput, context) => {
2270
- const contents = {
2271
- name: "NotAuthorizedException",
2272
- $fault: "client",
2273
- $metadata: deserializeMetadata(parsedOutput),
2274
- message: undefined,
2275
- };
1706
+ const contents = {};
2276
1707
  const data = parsedOutput.body;
2277
1708
  if (data.message !== undefined && data.message !== null) {
2278
1709
  contents.message = smithy_client_1.expectString(data.message);
2279
1710
  }
2280
- return contents;
1711
+ const exception = new models_0_1.NotAuthorizedException({
1712
+ $metadata: deserializeMetadata(parsedOutput),
1713
+ ...contents,
1714
+ });
1715
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2281
1716
  };
2282
1717
  const deserializeAws_restJson1ResourceConflictExceptionResponse = async (parsedOutput, context) => {
2283
- const contents = {
2284
- name: "ResourceConflictException",
2285
- $fault: "client",
2286
- $metadata: deserializeMetadata(parsedOutput),
2287
- message: undefined,
2288
- };
1718
+ const contents = {};
2289
1719
  const data = parsedOutput.body;
2290
1720
  if (data.message !== undefined && data.message !== null) {
2291
1721
  contents.message = smithy_client_1.expectString(data.message);
2292
1722
  }
2293
- return contents;
1723
+ const exception = new models_0_1.ResourceConflictException({
1724
+ $metadata: deserializeMetadata(parsedOutput),
1725
+ ...contents,
1726
+ });
1727
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2294
1728
  };
2295
1729
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2296
- const contents = {
2297
- name: "ResourceNotFoundException",
2298
- $fault: "client",
2299
- $metadata: deserializeMetadata(parsedOutput),
2300
- message: undefined,
2301
- };
1730
+ const contents = {};
2302
1731
  const data = parsedOutput.body;
2303
1732
  if (data.message !== undefined && data.message !== null) {
2304
1733
  contents.message = smithy_client_1.expectString(data.message);
2305
1734
  }
2306
- return contents;
1735
+ const exception = new models_0_1.ResourceNotFoundException({
1736
+ $metadata: deserializeMetadata(parsedOutput),
1737
+ ...contents,
1738
+ });
1739
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2307
1740
  };
2308
1741
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
2309
- const contents = {
2310
- name: "TooManyRequestsException",
2311
- $fault: "client",
2312
- $metadata: deserializeMetadata(parsedOutput),
2313
- message: undefined,
2314
- };
1742
+ const contents = {};
2315
1743
  const data = parsedOutput.body;
2316
1744
  if (data.message !== undefined && data.message !== null) {
2317
1745
  contents.message = smithy_client_1.expectString(data.message);
2318
1746
  }
2319
- return contents;
1747
+ const exception = new models_0_1.TooManyRequestsException({
1748
+ $metadata: deserializeMetadata(parsedOutput),
1749
+ ...contents,
1750
+ });
1751
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
2320
1752
  };
2321
1753
  const serializeAws_restJson1ApplicationArnList = (input, context) => {
2322
1754
  return input
@@ -2379,7 +1811,7 @@ const serializeAws_restJson1RecordPatchList = (input, context) => {
2379
1811
  });
2380
1812
  };
2381
1813
  const deserializeAws_restJson1ApplicationArnList = (output, context) => {
2382
- return (output || [])
1814
+ const retVal = (output || [])
2383
1815
  .filter((e) => e != null)
2384
1816
  .map((entry) => {
2385
1817
  if (entry === null) {
@@ -2387,6 +1819,7 @@ const deserializeAws_restJson1ApplicationArnList = (output, context) => {
2387
1819
  }
2388
1820
  return smithy_client_1.expectString(entry);
2389
1821
  });
1822
+ return retVal;
2390
1823
  };
2391
1824
  const deserializeAws_restJson1CognitoStreams = (output, context) => {
2392
1825
  return {
@@ -2411,7 +1844,7 @@ const deserializeAws_restJson1Dataset = (output, context) => {
2411
1844
  };
2412
1845
  };
2413
1846
  const deserializeAws_restJson1DatasetList = (output, context) => {
2414
- return (output || [])
1847
+ const retVal = (output || [])
2415
1848
  .filter((e) => e != null)
2416
1849
  .map((entry) => {
2417
1850
  if (entry === null) {
@@ -2419,6 +1852,7 @@ const deserializeAws_restJson1DatasetList = (output, context) => {
2419
1852
  }
2420
1853
  return deserializeAws_restJson1Dataset(entry, context);
2421
1854
  });
1855
+ return retVal;
2422
1856
  };
2423
1857
  const deserializeAws_restJson1Events = (output, context) => {
2424
1858
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -2442,7 +1876,7 @@ const deserializeAws_restJson1IdentityPoolUsage = (output, context) => {
2442
1876
  };
2443
1877
  };
2444
1878
  const deserializeAws_restJson1IdentityPoolUsageList = (output, context) => {
2445
- return (output || [])
1879
+ const retVal = (output || [])
2446
1880
  .filter((e) => e != null)
2447
1881
  .map((entry) => {
2448
1882
  if (entry === null) {
@@ -2450,6 +1884,7 @@ const deserializeAws_restJson1IdentityPoolUsageList = (output, context) => {
2450
1884
  }
2451
1885
  return deserializeAws_restJson1IdentityPoolUsage(entry, context);
2452
1886
  });
1887
+ return retVal;
2453
1888
  };
2454
1889
  const deserializeAws_restJson1IdentityUsage = (output, context) => {
2455
1890
  return {
@@ -2463,7 +1898,7 @@ const deserializeAws_restJson1IdentityUsage = (output, context) => {
2463
1898
  };
2464
1899
  };
2465
1900
  const deserializeAws_restJson1MergedDatasetNameList = (output, context) => {
2466
- return (output || [])
1901
+ const retVal = (output || [])
2467
1902
  .filter((e) => e != null)
2468
1903
  .map((entry) => {
2469
1904
  if (entry === null) {
@@ -2471,6 +1906,7 @@ const deserializeAws_restJson1MergedDatasetNameList = (output, context) => {
2471
1906
  }
2472
1907
  return smithy_client_1.expectString(entry);
2473
1908
  });
1909
+ return retVal;
2474
1910
  };
2475
1911
  const deserializeAws_restJson1PushSync = (output, context) => {
2476
1912
  return {
@@ -2495,7 +1931,7 @@ const deserializeAws_restJson1_Record = (output, context) => {
2495
1931
  };
2496
1932
  };
2497
1933
  const deserializeAws_restJson1RecordList = (output, context) => {
2498
- return (output || [])
1934
+ const retVal = (output || [])
2499
1935
  .filter((e) => e != null)
2500
1936
  .map((entry) => {
2501
1937
  if (entry === null) {
@@ -2503,6 +1939,7 @@ const deserializeAws_restJson1RecordList = (output, context) => {
2503
1939
  }
2504
1940
  return deserializeAws_restJson1_Record(entry, context);
2505
1941
  });
1942
+ return retVal;
2506
1943
  };
2507
1944
  const deserializeMetadata = (output) => {
2508
1945
  var _a;