@aws-sdk/client-greengrassv2 3.52.0 → 3.54.1

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.
@@ -5,6 +5,8 @@ exports.deserializeAws_restJson1UpdateConnectivityInfoCommand = exports.deserial
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const uuid_1 = require("uuid");
8
+ const GreengrassV2ServiceException_1 = require("../models/GreengrassV2ServiceException");
9
+ const models_0_1 = require("../models/models_0");
8
10
  const serializeAws_restJson1AssociateServiceRoleToAccountCommand = async (input, context) => {
9
11
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
12
  const headers = {
@@ -826,35 +828,19 @@ const deserializeAws_restJson1AssociateServiceRoleToAccountCommandError = async
826
828
  switch (errorCode) {
827
829
  case "InternalServerException":
828
830
  case "com.amazonaws.greengrassv2#InternalServerException":
829
- response = {
830
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
831
- name: errorCode,
832
- $metadata: deserializeMetadata(output),
833
- };
834
- break;
831
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
835
832
  case "ValidationException":
836
833
  case "com.amazonaws.greengrassv2#ValidationException":
837
- response = {
838
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
839
- name: errorCode,
840
- $metadata: deserializeMetadata(output),
841
- };
842
- break;
834
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
843
835
  default:
844
836
  const parsedBody = parsedOutput.body;
845
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
846
- response = {
847
- ...parsedBody,
848
- name: `${errorCode}`,
849
- message: parsedBody.message || parsedBody.Message || errorCode,
837
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
838
+ name: parsedBody.code || parsedBody.Code || errorCode,
850
839
  $fault: "client",
851
840
  $metadata: deserializeMetadata(output),
852
- };
841
+ });
842
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
853
843
  }
854
- const message = response.message || response.Message || errorCode;
855
- response.message = message;
856
- delete response.Message;
857
- return Promise.reject(Object.assign(new Error(message), response));
858
844
  };
859
845
  const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = async (output, context) => {
860
846
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -882,59 +868,28 @@ const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandErr
882
868
  switch (errorCode) {
883
869
  case "AccessDeniedException":
884
870
  case "com.amazonaws.greengrassv2#AccessDeniedException":
885
- response = {
886
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
887
- name: errorCode,
888
- $metadata: deserializeMetadata(output),
889
- };
890
- break;
871
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
891
872
  case "InternalServerException":
892
873
  case "com.amazonaws.greengrassv2#InternalServerException":
893
- response = {
894
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
895
- name: errorCode,
896
- $metadata: deserializeMetadata(output),
897
- };
898
- break;
874
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
899
875
  case "ResourceNotFoundException":
900
876
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
901
- response = {
902
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
903
- name: errorCode,
904
- $metadata: deserializeMetadata(output),
905
- };
906
- break;
877
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
907
878
  case "ThrottlingException":
908
879
  case "com.amazonaws.greengrassv2#ThrottlingException":
909
- response = {
910
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
911
- name: errorCode,
912
- $metadata: deserializeMetadata(output),
913
- };
914
- break;
880
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
915
881
  case "ValidationException":
916
882
  case "com.amazonaws.greengrassv2#ValidationException":
917
- response = {
918
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
919
- name: errorCode,
920
- $metadata: deserializeMetadata(output),
921
- };
922
- break;
883
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
923
884
  default:
924
885
  const parsedBody = parsedOutput.body;
925
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
926
- response = {
927
- ...parsedBody,
928
- name: `${errorCode}`,
929
- message: parsedBody.message || parsedBody.Message || errorCode,
886
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
887
+ name: parsedBody.code || parsedBody.Code || errorCode,
930
888
  $fault: "client",
931
889
  $metadata: deserializeMetadata(output),
932
- };
890
+ });
891
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
933
892
  }
934
- const message = response.message || response.Message || errorCode;
935
- response.message = message;
936
- delete response.Message;
937
- return Promise.reject(Object.assign(new Error(message), response));
938
893
  };
939
894
  const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand = async (output, context) => {
940
895
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -962,59 +917,28 @@ const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand
962
917
  switch (errorCode) {
963
918
  case "AccessDeniedException":
964
919
  case "com.amazonaws.greengrassv2#AccessDeniedException":
965
- response = {
966
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
967
- name: errorCode,
968
- $metadata: deserializeMetadata(output),
969
- };
970
- break;
920
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
971
921
  case "InternalServerException":
972
922
  case "com.amazonaws.greengrassv2#InternalServerException":
973
- response = {
974
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
975
- name: errorCode,
976
- $metadata: deserializeMetadata(output),
977
- };
978
- break;
923
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
979
924
  case "ResourceNotFoundException":
980
925
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
981
- response = {
982
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
983
- name: errorCode,
984
- $metadata: deserializeMetadata(output),
985
- };
986
- break;
926
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
987
927
  case "ThrottlingException":
988
928
  case "com.amazonaws.greengrassv2#ThrottlingException":
989
- response = {
990
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
991
- name: errorCode,
992
- $metadata: deserializeMetadata(output),
993
- };
994
- break;
929
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
995
930
  case "ValidationException":
996
931
  case "com.amazonaws.greengrassv2#ValidationException":
997
- response = {
998
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
999
- name: errorCode,
1000
- $metadata: deserializeMetadata(output),
1001
- };
1002
- break;
932
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1003
933
  default:
1004
934
  const parsedBody = parsedOutput.body;
1005
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1006
- response = {
1007
- ...parsedBody,
1008
- name: `${errorCode}`,
1009
- message: parsedBody.message || parsedBody.Message || errorCode,
935
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
936
+ name: parsedBody.code || parsedBody.Code || errorCode,
1010
937
  $fault: "client",
1011
938
  $metadata: deserializeMetadata(output),
1012
- };
939
+ });
940
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1013
941
  }
1014
- const message = response.message || response.Message || errorCode;
1015
- response.message = message;
1016
- delete response.Message;
1017
- return Promise.reject(Object.assign(new Error(message), response));
1018
942
  };
1019
943
  const deserializeAws_restJson1CancelDeploymentCommand = async (output, context) => {
1020
944
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1042,67 +966,31 @@ const deserializeAws_restJson1CancelDeploymentCommandError = async (output, cont
1042
966
  switch (errorCode) {
1043
967
  case "AccessDeniedException":
1044
968
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1045
- response = {
1046
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1047
- name: errorCode,
1048
- $metadata: deserializeMetadata(output),
1049
- };
1050
- break;
969
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1051
970
  case "ConflictException":
1052
971
  case "com.amazonaws.greengrassv2#ConflictException":
1053
- response = {
1054
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1055
- name: errorCode,
1056
- $metadata: deserializeMetadata(output),
1057
- };
1058
- break;
972
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1059
973
  case "InternalServerException":
1060
974
  case "com.amazonaws.greengrassv2#InternalServerException":
1061
- response = {
1062
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1063
- name: errorCode,
1064
- $metadata: deserializeMetadata(output),
1065
- };
1066
- break;
975
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1067
976
  case "ResourceNotFoundException":
1068
977
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1069
- response = {
1070
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1071
- name: errorCode,
1072
- $metadata: deserializeMetadata(output),
1073
- };
1074
- break;
978
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1075
979
  case "ThrottlingException":
1076
980
  case "com.amazonaws.greengrassv2#ThrottlingException":
1077
- response = {
1078
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1079
- name: errorCode,
1080
- $metadata: deserializeMetadata(output),
1081
- };
1082
- break;
981
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1083
982
  case "ValidationException":
1084
983
  case "com.amazonaws.greengrassv2#ValidationException":
1085
- response = {
1086
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1087
- name: errorCode,
1088
- $metadata: deserializeMetadata(output),
1089
- };
1090
- break;
984
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1091
985
  default:
1092
986
  const parsedBody = parsedOutput.body;
1093
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1094
- response = {
1095
- ...parsedBody,
1096
- name: `${errorCode}`,
1097
- message: parsedBody.message || parsedBody.Message || errorCode,
987
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
988
+ name: parsedBody.code || parsedBody.Code || errorCode,
1098
989
  $fault: "client",
1099
990
  $metadata: deserializeMetadata(output),
1100
- };
991
+ });
992
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1101
993
  }
1102
- const message = response.message || response.Message || errorCode;
1103
- response.message = message;
1104
- delete response.Message;
1105
- return Promise.reject(Object.assign(new Error(message), response));
1106
994
  };
1107
995
  const deserializeAws_restJson1CreateComponentVersionCommand = async (output, context) => {
1108
996
  if (output.statusCode !== 201 && output.statusCode >= 300) {
@@ -1146,75 +1034,34 @@ const deserializeAws_restJson1CreateComponentVersionCommandError = async (output
1146
1034
  switch (errorCode) {
1147
1035
  case "AccessDeniedException":
1148
1036
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1149
- response = {
1150
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1151
- name: errorCode,
1152
- $metadata: deserializeMetadata(output),
1153
- };
1154
- break;
1037
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1155
1038
  case "ConflictException":
1156
1039
  case "com.amazonaws.greengrassv2#ConflictException":
1157
- response = {
1158
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1159
- name: errorCode,
1160
- $metadata: deserializeMetadata(output),
1161
- };
1162
- break;
1040
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1163
1041
  case "InternalServerException":
1164
1042
  case "com.amazonaws.greengrassv2#InternalServerException":
1165
- response = {
1166
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1167
- name: errorCode,
1168
- $metadata: deserializeMetadata(output),
1169
- };
1170
- break;
1043
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1171
1044
  case "RequestAlreadyInProgressException":
1172
1045
  case "com.amazonaws.greengrassv2#RequestAlreadyInProgressException":
1173
- response = {
1174
- ...(await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse(parsedOutput, context)),
1175
- name: errorCode,
1176
- $metadata: deserializeMetadata(output),
1177
- };
1178
- break;
1046
+ throw await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse(parsedOutput, context);
1179
1047
  case "ServiceQuotaExceededException":
1180
1048
  case "com.amazonaws.greengrassv2#ServiceQuotaExceededException":
1181
- response = {
1182
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1183
- name: errorCode,
1184
- $metadata: deserializeMetadata(output),
1185
- };
1186
- break;
1049
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
1187
1050
  case "ThrottlingException":
1188
1051
  case "com.amazonaws.greengrassv2#ThrottlingException":
1189
- response = {
1190
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1191
- name: errorCode,
1192
- $metadata: deserializeMetadata(output),
1193
- };
1194
- break;
1052
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1195
1053
  case "ValidationException":
1196
1054
  case "com.amazonaws.greengrassv2#ValidationException":
1197
- response = {
1198
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1199
- name: errorCode,
1200
- $metadata: deserializeMetadata(output),
1201
- };
1202
- break;
1055
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1203
1056
  default:
1204
1057
  const parsedBody = parsedOutput.body;
1205
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1206
- response = {
1207
- ...parsedBody,
1208
- name: `${errorCode}`,
1209
- message: parsedBody.message || parsedBody.Message || errorCode,
1058
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1059
+ name: parsedBody.code || parsedBody.Code || errorCode,
1210
1060
  $fault: "client",
1211
1061
  $metadata: deserializeMetadata(output),
1212
- };
1062
+ });
1063
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1213
1064
  }
1214
- const message = response.message || response.Message || errorCode;
1215
- response.message = message;
1216
- delete response.Message;
1217
- return Promise.reject(Object.assign(new Error(message), response));
1218
1065
  };
1219
1066
  const deserializeAws_restJson1CreateDeploymentCommand = async (output, context) => {
1220
1067
  if (output.statusCode !== 201 && output.statusCode >= 300) {
@@ -1250,67 +1097,31 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1250
1097
  switch (errorCode) {
1251
1098
  case "AccessDeniedException":
1252
1099
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1253
- response = {
1254
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1255
- name: errorCode,
1256
- $metadata: deserializeMetadata(output),
1257
- };
1258
- break;
1100
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1259
1101
  case "InternalServerException":
1260
1102
  case "com.amazonaws.greengrassv2#InternalServerException":
1261
- response = {
1262
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1263
- name: errorCode,
1264
- $metadata: deserializeMetadata(output),
1265
- };
1266
- break;
1103
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1267
1104
  case "RequestAlreadyInProgressException":
1268
1105
  case "com.amazonaws.greengrassv2#RequestAlreadyInProgressException":
1269
- response = {
1270
- ...(await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse(parsedOutput, context)),
1271
- name: errorCode,
1272
- $metadata: deserializeMetadata(output),
1273
- };
1274
- break;
1106
+ throw await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse(parsedOutput, context);
1275
1107
  case "ResourceNotFoundException":
1276
1108
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1277
- response = {
1278
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1279
- name: errorCode,
1280
- $metadata: deserializeMetadata(output),
1281
- };
1282
- break;
1109
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1283
1110
  case "ThrottlingException":
1284
1111
  case "com.amazonaws.greengrassv2#ThrottlingException":
1285
- response = {
1286
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1287
- name: errorCode,
1288
- $metadata: deserializeMetadata(output),
1289
- };
1290
- break;
1112
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1291
1113
  case "ValidationException":
1292
1114
  case "com.amazonaws.greengrassv2#ValidationException":
1293
- response = {
1294
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1295
- name: errorCode,
1296
- $metadata: deserializeMetadata(output),
1297
- };
1298
- break;
1115
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1299
1116
  default:
1300
1117
  const parsedBody = parsedOutput.body;
1301
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1302
- response = {
1303
- ...parsedBody,
1304
- name: `${errorCode}`,
1305
- message: parsedBody.message || parsedBody.Message || errorCode,
1118
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1119
+ name: parsedBody.code || parsedBody.Code || errorCode,
1306
1120
  $fault: "client",
1307
1121
  $metadata: deserializeMetadata(output),
1308
- };
1122
+ });
1123
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1309
1124
  }
1310
- const message = response.message || response.Message || errorCode;
1311
- response.message = message;
1312
- delete response.Message;
1313
- return Promise.reject(Object.assign(new Error(message), response));
1314
1125
  };
1315
1126
  const deserializeAws_restJson1DeleteComponentCommand = async (output, context) => {
1316
1127
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1334,67 +1145,31 @@ const deserializeAws_restJson1DeleteComponentCommandError = async (output, conte
1334
1145
  switch (errorCode) {
1335
1146
  case "AccessDeniedException":
1336
1147
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1337
- response = {
1338
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1339
- name: errorCode,
1340
- $metadata: deserializeMetadata(output),
1341
- };
1342
- break;
1148
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1343
1149
  case "ConflictException":
1344
1150
  case "com.amazonaws.greengrassv2#ConflictException":
1345
- response = {
1346
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1347
- name: errorCode,
1348
- $metadata: deserializeMetadata(output),
1349
- };
1350
- break;
1151
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1351
1152
  case "InternalServerException":
1352
1153
  case "com.amazonaws.greengrassv2#InternalServerException":
1353
- response = {
1354
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1355
- name: errorCode,
1356
- $metadata: deserializeMetadata(output),
1357
- };
1358
- break;
1154
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1359
1155
  case "ResourceNotFoundException":
1360
1156
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1361
- response = {
1362
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1363
- name: errorCode,
1364
- $metadata: deserializeMetadata(output),
1365
- };
1366
- break;
1157
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1367
1158
  case "ThrottlingException":
1368
1159
  case "com.amazonaws.greengrassv2#ThrottlingException":
1369
- response = {
1370
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1371
- name: errorCode,
1372
- $metadata: deserializeMetadata(output),
1373
- };
1374
- break;
1160
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1375
1161
  case "ValidationException":
1376
1162
  case "com.amazonaws.greengrassv2#ValidationException":
1377
- response = {
1378
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1379
- name: errorCode,
1380
- $metadata: deserializeMetadata(output),
1381
- };
1382
- break;
1163
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1383
1164
  default:
1384
1165
  const parsedBody = parsedOutput.body;
1385
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1386
- response = {
1387
- ...parsedBody,
1388
- name: `${errorCode}`,
1389
- message: parsedBody.message || parsedBody.Message || errorCode,
1166
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1167
+ name: parsedBody.code || parsedBody.Code || errorCode,
1390
1168
  $fault: "client",
1391
1169
  $metadata: deserializeMetadata(output),
1392
- };
1170
+ });
1171
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1393
1172
  }
1394
- const message = response.message || response.Message || errorCode;
1395
- response.message = message;
1396
- delete response.Message;
1397
- return Promise.reject(Object.assign(new Error(message), response));
1398
1173
  };
1399
1174
  const deserializeAws_restJson1DeleteCoreDeviceCommand = async (output, context) => {
1400
1175
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1418,67 +1193,31 @@ const deserializeAws_restJson1DeleteCoreDeviceCommandError = async (output, cont
1418
1193
  switch (errorCode) {
1419
1194
  case "AccessDeniedException":
1420
1195
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1421
- response = {
1422
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1423
- name: errorCode,
1424
- $metadata: deserializeMetadata(output),
1425
- };
1426
- break;
1196
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1427
1197
  case "ConflictException":
1428
1198
  case "com.amazonaws.greengrassv2#ConflictException":
1429
- response = {
1430
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1431
- name: errorCode,
1432
- $metadata: deserializeMetadata(output),
1433
- };
1434
- break;
1199
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1435
1200
  case "InternalServerException":
1436
1201
  case "com.amazonaws.greengrassv2#InternalServerException":
1437
- response = {
1438
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1439
- name: errorCode,
1440
- $metadata: deserializeMetadata(output),
1441
- };
1442
- break;
1202
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1443
1203
  case "ResourceNotFoundException":
1444
1204
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1445
- response = {
1446
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1447
- name: errorCode,
1448
- $metadata: deserializeMetadata(output),
1449
- };
1450
- break;
1205
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1451
1206
  case "ThrottlingException":
1452
1207
  case "com.amazonaws.greengrassv2#ThrottlingException":
1453
- response = {
1454
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1455
- name: errorCode,
1456
- $metadata: deserializeMetadata(output),
1457
- };
1458
- break;
1208
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1459
1209
  case "ValidationException":
1460
1210
  case "com.amazonaws.greengrassv2#ValidationException":
1461
- response = {
1462
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1463
- name: errorCode,
1464
- $metadata: deserializeMetadata(output),
1465
- };
1466
- break;
1211
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1467
1212
  default:
1468
1213
  const parsedBody = parsedOutput.body;
1469
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1470
- response = {
1471
- ...parsedBody,
1472
- name: `${errorCode}`,
1473
- message: parsedBody.message || parsedBody.Message || errorCode,
1214
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1215
+ name: parsedBody.code || parsedBody.Code || errorCode,
1474
1216
  $fault: "client",
1475
1217
  $metadata: deserializeMetadata(output),
1476
- };
1218
+ });
1219
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1477
1220
  }
1478
- const message = response.message || response.Message || errorCode;
1479
- response.message = message;
1480
- delete response.Message;
1481
- return Promise.reject(Object.assign(new Error(message), response));
1482
1221
  };
1483
1222
  const deserializeAws_restJson1DescribeComponentCommand = async (output, context) => {
1484
1223
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1538,59 +1277,28 @@ const deserializeAws_restJson1DescribeComponentCommandError = async (output, con
1538
1277
  switch (errorCode) {
1539
1278
  case "AccessDeniedException":
1540
1279
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1541
- response = {
1542
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1543
- name: errorCode,
1544
- $metadata: deserializeMetadata(output),
1545
- };
1546
- break;
1280
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1547
1281
  case "InternalServerException":
1548
1282
  case "com.amazonaws.greengrassv2#InternalServerException":
1549
- response = {
1550
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1551
- name: errorCode,
1552
- $metadata: deserializeMetadata(output),
1553
- };
1554
- break;
1283
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1555
1284
  case "ResourceNotFoundException":
1556
1285
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1557
- response = {
1558
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1559
- name: errorCode,
1560
- $metadata: deserializeMetadata(output),
1561
- };
1562
- break;
1286
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1563
1287
  case "ThrottlingException":
1564
1288
  case "com.amazonaws.greengrassv2#ThrottlingException":
1565
- response = {
1566
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1567
- name: errorCode,
1568
- $metadata: deserializeMetadata(output),
1569
- };
1570
- break;
1289
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1571
1290
  case "ValidationException":
1572
1291
  case "com.amazonaws.greengrassv2#ValidationException":
1573
- response = {
1574
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1575
- name: errorCode,
1576
- $metadata: deserializeMetadata(output),
1577
- };
1578
- break;
1292
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1579
1293
  default:
1580
1294
  const parsedBody = parsedOutput.body;
1581
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1582
- response = {
1583
- ...parsedBody,
1584
- name: `${errorCode}`,
1585
- message: parsedBody.message || parsedBody.Message || errorCode,
1295
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1296
+ name: parsedBody.code || parsedBody.Code || errorCode,
1586
1297
  $fault: "client",
1587
1298
  $metadata: deserializeMetadata(output),
1588
- };
1299
+ });
1300
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1589
1301
  }
1590
- const message = response.message || response.Message || errorCode;
1591
- response.message = message;
1592
- delete response.Message;
1593
- return Promise.reject(Object.assign(new Error(message), response));
1594
1302
  };
1595
1303
  const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommand = async (output, context) => {
1596
1304
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1618,27 +1326,16 @@ const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError = a
1618
1326
  switch (errorCode) {
1619
1327
  case "InternalServerException":
1620
1328
  case "com.amazonaws.greengrassv2#InternalServerException":
1621
- response = {
1622
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1623
- name: errorCode,
1624
- $metadata: deserializeMetadata(output),
1625
- };
1626
- break;
1329
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1627
1330
  default:
1628
1331
  const parsedBody = parsedOutput.body;
1629
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1630
- response = {
1631
- ...parsedBody,
1632
- name: `${errorCode}`,
1633
- message: parsedBody.message || parsedBody.Message || errorCode,
1332
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1333
+ name: parsedBody.code || parsedBody.Code || errorCode,
1634
1334
  $fault: "client",
1635
1335
  $metadata: deserializeMetadata(output),
1636
- };
1336
+ });
1337
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1637
1338
  }
1638
- const message = response.message || response.Message || errorCode;
1639
- response.message = message;
1640
- delete response.Message;
1641
- return Promise.reject(Object.assign(new Error(message), response));
1642
1339
  };
1643
1340
  const deserializeAws_restJson1GetComponentCommand = async (output, context) => {
1644
1341
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1674,59 +1371,28 @@ const deserializeAws_restJson1GetComponentCommandError = async (output, context)
1674
1371
  switch (errorCode) {
1675
1372
  case "AccessDeniedException":
1676
1373
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1677
- response = {
1678
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1679
- name: errorCode,
1680
- $metadata: deserializeMetadata(output),
1681
- };
1682
- break;
1374
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1683
1375
  case "InternalServerException":
1684
1376
  case "com.amazonaws.greengrassv2#InternalServerException":
1685
- response = {
1686
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1687
- name: errorCode,
1688
- $metadata: deserializeMetadata(output),
1689
- };
1690
- break;
1377
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1691
1378
  case "ResourceNotFoundException":
1692
1379
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1693
- response = {
1694
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1695
- name: errorCode,
1696
- $metadata: deserializeMetadata(output),
1697
- };
1698
- break;
1380
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1699
1381
  case "ThrottlingException":
1700
1382
  case "com.amazonaws.greengrassv2#ThrottlingException":
1701
- response = {
1702
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1703
- name: errorCode,
1704
- $metadata: deserializeMetadata(output),
1705
- };
1706
- break;
1383
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1707
1384
  case "ValidationException":
1708
1385
  case "com.amazonaws.greengrassv2#ValidationException":
1709
- response = {
1710
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1711
- name: errorCode,
1712
- $metadata: deserializeMetadata(output),
1713
- };
1714
- break;
1386
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1715
1387
  default:
1716
1388
  const parsedBody = parsedOutput.body;
1717
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1718
- response = {
1719
- ...parsedBody,
1720
- name: `${errorCode}`,
1721
- message: parsedBody.message || parsedBody.Message || errorCode,
1389
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1390
+ name: parsedBody.code || parsedBody.Code || errorCode,
1722
1391
  $fault: "client",
1723
1392
  $metadata: deserializeMetadata(output),
1724
- };
1393
+ });
1394
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1725
1395
  }
1726
- const message = response.message || response.Message || errorCode;
1727
- response.message = message;
1728
- delete response.Message;
1729
- return Promise.reject(Object.assign(new Error(message), response));
1730
1396
  };
1731
1397
  const deserializeAws_restJson1GetComponentVersionArtifactCommand = async (output, context) => {
1732
1398
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1754,59 +1420,28 @@ const deserializeAws_restJson1GetComponentVersionArtifactCommandError = async (o
1754
1420
  switch (errorCode) {
1755
1421
  case "AccessDeniedException":
1756
1422
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1757
- response = {
1758
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1759
- name: errorCode,
1760
- $metadata: deserializeMetadata(output),
1761
- };
1762
- break;
1423
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1763
1424
  case "InternalServerException":
1764
1425
  case "com.amazonaws.greengrassv2#InternalServerException":
1765
- response = {
1766
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1767
- name: errorCode,
1768
- $metadata: deserializeMetadata(output),
1769
- };
1770
- break;
1426
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1771
1427
  case "ResourceNotFoundException":
1772
1428
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1773
- response = {
1774
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1775
- name: errorCode,
1776
- $metadata: deserializeMetadata(output),
1777
- };
1778
- break;
1429
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1779
1430
  case "ThrottlingException":
1780
1431
  case "com.amazonaws.greengrassv2#ThrottlingException":
1781
- response = {
1782
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1783
- name: errorCode,
1784
- $metadata: deserializeMetadata(output),
1785
- };
1786
- break;
1432
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1787
1433
  case "ValidationException":
1788
1434
  case "com.amazonaws.greengrassv2#ValidationException":
1789
- response = {
1790
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1791
- name: errorCode,
1792
- $metadata: deserializeMetadata(output),
1793
- };
1794
- break;
1435
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1795
1436
  default:
1796
1437
  const parsedBody = parsedOutput.body;
1797
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1798
- response = {
1799
- ...parsedBody,
1800
- name: `${errorCode}`,
1801
- message: parsedBody.message || parsedBody.Message || errorCode,
1438
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1439
+ name: parsedBody.code || parsedBody.Code || errorCode,
1802
1440
  $fault: "client",
1803
1441
  $metadata: deserializeMetadata(output),
1804
- };
1442
+ });
1443
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1805
1444
  }
1806
- const message = response.message || response.Message || errorCode;
1807
- response.message = message;
1808
- delete response.Message;
1809
- return Promise.reject(Object.assign(new Error(message), response));
1810
1445
  };
1811
1446
  const deserializeAws_restJson1GetConnectivityInfoCommand = async (output, context) => {
1812
1447
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1838,35 +1473,19 @@ const deserializeAws_restJson1GetConnectivityInfoCommandError = async (output, c
1838
1473
  switch (errorCode) {
1839
1474
  case "InternalServerException":
1840
1475
  case "com.amazonaws.greengrassv2#InternalServerException":
1841
- response = {
1842
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1843
- name: errorCode,
1844
- $metadata: deserializeMetadata(output),
1845
- };
1846
- break;
1476
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1847
1477
  case "ValidationException":
1848
1478
  case "com.amazonaws.greengrassv2#ValidationException":
1849
- response = {
1850
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1851
- name: errorCode,
1852
- $metadata: deserializeMetadata(output),
1853
- };
1854
- break;
1479
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1855
1480
  default:
1856
1481
  const parsedBody = parsedOutput.body;
1857
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1858
- response = {
1859
- ...parsedBody,
1860
- name: `${errorCode}`,
1861
- message: parsedBody.message || parsedBody.Message || errorCode,
1482
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1483
+ name: parsedBody.code || parsedBody.Code || errorCode,
1862
1484
  $fault: "client",
1863
1485
  $metadata: deserializeMetadata(output),
1864
- };
1486
+ });
1487
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1865
1488
  }
1866
- const message = response.message || response.Message || errorCode;
1867
- response.message = message;
1868
- delete response.Message;
1869
- return Promise.reject(Object.assign(new Error(message), response));
1870
1489
  };
1871
1490
  const deserializeAws_restJson1GetCoreDeviceCommand = async (output, context) => {
1872
1491
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1918,59 +1537,28 @@ const deserializeAws_restJson1GetCoreDeviceCommandError = async (output, context
1918
1537
  switch (errorCode) {
1919
1538
  case "AccessDeniedException":
1920
1539
  case "com.amazonaws.greengrassv2#AccessDeniedException":
1921
- response = {
1922
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1923
- name: errorCode,
1924
- $metadata: deserializeMetadata(output),
1925
- };
1926
- break;
1540
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1927
1541
  case "InternalServerException":
1928
1542
  case "com.amazonaws.greengrassv2#InternalServerException":
1929
- response = {
1930
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1931
- name: errorCode,
1932
- $metadata: deserializeMetadata(output),
1933
- };
1934
- break;
1543
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1935
1544
  case "ResourceNotFoundException":
1936
1545
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
1937
- response = {
1938
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1939
- name: errorCode,
1940
- $metadata: deserializeMetadata(output),
1941
- };
1942
- break;
1546
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1943
1547
  case "ThrottlingException":
1944
1548
  case "com.amazonaws.greengrassv2#ThrottlingException":
1945
- response = {
1946
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1947
- name: errorCode,
1948
- $metadata: deserializeMetadata(output),
1949
- };
1950
- break;
1549
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1951
1550
  case "ValidationException":
1952
1551
  case "com.amazonaws.greengrassv2#ValidationException":
1953
- response = {
1954
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1955
- name: errorCode,
1956
- $metadata: deserializeMetadata(output),
1957
- };
1958
- break;
1552
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1959
1553
  default:
1960
1554
  const parsedBody = parsedOutput.body;
1961
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1962
- response = {
1963
- ...parsedBody,
1964
- name: `${errorCode}`,
1965
- message: parsedBody.message || parsedBody.Message || errorCode,
1555
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1556
+ name: parsedBody.code || parsedBody.Code || errorCode,
1966
1557
  $fault: "client",
1967
1558
  $metadata: deserializeMetadata(output),
1968
- };
1559
+ });
1560
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1969
1561
  }
1970
- const message = response.message || response.Message || errorCode;
1971
- response.message = message;
1972
- delete response.Message;
1973
- return Promise.reject(Object.assign(new Error(message), response));
1974
1562
  };
1975
1563
  const deserializeAws_restJson1GetDeploymentCommand = async (output, context) => {
1976
1564
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2046,59 +1634,28 @@ const deserializeAws_restJson1GetDeploymentCommandError = async (output, context
2046
1634
  switch (errorCode) {
2047
1635
  case "AccessDeniedException":
2048
1636
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2049
- response = {
2050
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2051
- name: errorCode,
2052
- $metadata: deserializeMetadata(output),
2053
- };
2054
- break;
1637
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2055
1638
  case "InternalServerException":
2056
1639
  case "com.amazonaws.greengrassv2#InternalServerException":
2057
- response = {
2058
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2059
- name: errorCode,
2060
- $metadata: deserializeMetadata(output),
2061
- };
2062
- break;
1640
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2063
1641
  case "ResourceNotFoundException":
2064
1642
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2065
- response = {
2066
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2067
- name: errorCode,
2068
- $metadata: deserializeMetadata(output),
2069
- };
2070
- break;
1643
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2071
1644
  case "ThrottlingException":
2072
1645
  case "com.amazonaws.greengrassv2#ThrottlingException":
2073
- response = {
2074
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2075
- name: errorCode,
2076
- $metadata: deserializeMetadata(output),
2077
- };
2078
- break;
1646
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2079
1647
  case "ValidationException":
2080
1648
  case "com.amazonaws.greengrassv2#ValidationException":
2081
- response = {
2082
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2083
- name: errorCode,
2084
- $metadata: deserializeMetadata(output),
2085
- };
2086
- break;
1649
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2087
1650
  default:
2088
1651
  const parsedBody = parsedOutput.body;
2089
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2090
- response = {
2091
- ...parsedBody,
2092
- name: `${errorCode}`,
2093
- message: parsedBody.message || parsedBody.Message || errorCode,
1652
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1653
+ name: parsedBody.code || parsedBody.Code || errorCode,
2094
1654
  $fault: "client",
2095
1655
  $metadata: deserializeMetadata(output),
2096
- };
1656
+ });
1657
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2097
1658
  }
2098
- const message = response.message || response.Message || errorCode;
2099
- response.message = message;
2100
- delete response.Message;
2101
- return Promise.reject(Object.assign(new Error(message), response));
2102
1659
  };
2103
1660
  const deserializeAws_restJson1GetServiceRoleForAccountCommand = async (output, context) => {
2104
1661
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2130,27 +1687,16 @@ const deserializeAws_restJson1GetServiceRoleForAccountCommandError = async (outp
2130
1687
  switch (errorCode) {
2131
1688
  case "InternalServerException":
2132
1689
  case "com.amazonaws.greengrassv2#InternalServerException":
2133
- response = {
2134
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2135
- name: errorCode,
2136
- $metadata: deserializeMetadata(output),
2137
- };
2138
- break;
1690
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2139
1691
  default:
2140
1692
  const parsedBody = parsedOutput.body;
2141
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2142
- response = {
2143
- ...parsedBody,
2144
- name: `${errorCode}`,
2145
- message: parsedBody.message || parsedBody.Message || errorCode,
1693
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1694
+ name: parsedBody.code || parsedBody.Code || errorCode,
2146
1695
  $fault: "client",
2147
1696
  $metadata: deserializeMetadata(output),
2148
- };
1697
+ });
1698
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2149
1699
  }
2150
- const message = response.message || response.Message || errorCode;
2151
- response.message = message;
2152
- delete response.Message;
2153
- return Promise.reject(Object.assign(new Error(message), response));
2154
1700
  };
2155
1701
  const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = async (output, context) => {
2156
1702
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2182,59 +1728,28 @@ const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandEr
2182
1728
  switch (errorCode) {
2183
1729
  case "AccessDeniedException":
2184
1730
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2185
- response = {
2186
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2187
- name: errorCode,
2188
- $metadata: deserializeMetadata(output),
2189
- };
2190
- break;
1731
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2191
1732
  case "InternalServerException":
2192
1733
  case "com.amazonaws.greengrassv2#InternalServerException":
2193
- response = {
2194
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2195
- name: errorCode,
2196
- $metadata: deserializeMetadata(output),
2197
- };
2198
- break;
1734
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2199
1735
  case "ResourceNotFoundException":
2200
1736
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2201
- response = {
2202
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2203
- name: errorCode,
2204
- $metadata: deserializeMetadata(output),
2205
- };
2206
- break;
1737
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2207
1738
  case "ThrottlingException":
2208
1739
  case "com.amazonaws.greengrassv2#ThrottlingException":
2209
- response = {
2210
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2211
- name: errorCode,
2212
- $metadata: deserializeMetadata(output),
2213
- };
2214
- break;
1740
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2215
1741
  case "ValidationException":
2216
1742
  case "com.amazonaws.greengrassv2#ValidationException":
2217
- response = {
2218
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2219
- name: errorCode,
2220
- $metadata: deserializeMetadata(output),
2221
- };
2222
- break;
1743
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2223
1744
  default:
2224
1745
  const parsedBody = parsedOutput.body;
2225
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2226
- response = {
2227
- ...parsedBody,
2228
- name: `${errorCode}`,
2229
- message: parsedBody.message || parsedBody.Message || errorCode,
1746
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1747
+ name: parsedBody.code || parsedBody.Code || errorCode,
2230
1748
  $fault: "client",
2231
1749
  $metadata: deserializeMetadata(output),
2232
- };
1750
+ });
1751
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2233
1752
  }
2234
- const message = response.message || response.Message || errorCode;
2235
- response.message = message;
2236
- delete response.Message;
2237
- return Promise.reject(Object.assign(new Error(message), response));
2238
1753
  };
2239
1754
  const deserializeAws_restJson1ListComponentsCommand = async (output, context) => {
2240
1755
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2266,51 +1781,25 @@ const deserializeAws_restJson1ListComponentsCommandError = async (output, contex
2266
1781
  switch (errorCode) {
2267
1782
  case "AccessDeniedException":
2268
1783
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2269
- response = {
2270
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2271
- name: errorCode,
2272
- $metadata: deserializeMetadata(output),
2273
- };
2274
- break;
1784
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2275
1785
  case "InternalServerException":
2276
1786
  case "com.amazonaws.greengrassv2#InternalServerException":
2277
- response = {
2278
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2279
- name: errorCode,
2280
- $metadata: deserializeMetadata(output),
2281
- };
2282
- break;
1787
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2283
1788
  case "ThrottlingException":
2284
1789
  case "com.amazonaws.greengrassv2#ThrottlingException":
2285
- response = {
2286
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2287
- name: errorCode,
2288
- $metadata: deserializeMetadata(output),
2289
- };
2290
- break;
1790
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2291
1791
  case "ValidationException":
2292
1792
  case "com.amazonaws.greengrassv2#ValidationException":
2293
- response = {
2294
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2295
- name: errorCode,
2296
- $metadata: deserializeMetadata(output),
2297
- };
2298
- break;
1793
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2299
1794
  default:
2300
1795
  const parsedBody = parsedOutput.body;
2301
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2302
- response = {
2303
- ...parsedBody,
2304
- name: `${errorCode}`,
2305
- message: parsedBody.message || parsedBody.Message || errorCode,
1796
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1797
+ name: parsedBody.code || parsedBody.Code || errorCode,
2306
1798
  $fault: "client",
2307
1799
  $metadata: deserializeMetadata(output),
2308
- };
1800
+ });
1801
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2309
1802
  }
2310
- const message = response.message || response.Message || errorCode;
2311
- response.message = message;
2312
- delete response.Message;
2313
- return Promise.reject(Object.assign(new Error(message), response));
2314
1803
  };
2315
1804
  const deserializeAws_restJson1ListComponentVersionsCommand = async (output, context) => {
2316
1805
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2342,59 +1831,28 @@ const deserializeAws_restJson1ListComponentVersionsCommandError = async (output,
2342
1831
  switch (errorCode) {
2343
1832
  case "AccessDeniedException":
2344
1833
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2345
- response = {
2346
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2347
- name: errorCode,
2348
- $metadata: deserializeMetadata(output),
2349
- };
2350
- break;
1834
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2351
1835
  case "InternalServerException":
2352
1836
  case "com.amazonaws.greengrassv2#InternalServerException":
2353
- response = {
2354
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2355
- name: errorCode,
2356
- $metadata: deserializeMetadata(output),
2357
- };
2358
- break;
1837
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2359
1838
  case "ResourceNotFoundException":
2360
1839
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2361
- response = {
2362
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2363
- name: errorCode,
2364
- $metadata: deserializeMetadata(output),
2365
- };
2366
- break;
1840
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2367
1841
  case "ThrottlingException":
2368
1842
  case "com.amazonaws.greengrassv2#ThrottlingException":
2369
- response = {
2370
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2371
- name: errorCode,
2372
- $metadata: deserializeMetadata(output),
2373
- };
2374
- break;
1843
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2375
1844
  case "ValidationException":
2376
1845
  case "com.amazonaws.greengrassv2#ValidationException":
2377
- response = {
2378
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2379
- name: errorCode,
2380
- $metadata: deserializeMetadata(output),
2381
- };
2382
- break;
1846
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2383
1847
  default:
2384
1848
  const parsedBody = parsedOutput.body;
2385
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2386
- response = {
2387
- ...parsedBody,
2388
- name: `${errorCode}`,
2389
- message: parsedBody.message || parsedBody.Message || errorCode,
1849
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1850
+ name: parsedBody.code || parsedBody.Code || errorCode,
2390
1851
  $fault: "client",
2391
1852
  $metadata: deserializeMetadata(output),
2392
- };
1853
+ });
1854
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2393
1855
  }
2394
- const message = response.message || response.Message || errorCode;
2395
- response.message = message;
2396
- delete response.Message;
2397
- return Promise.reject(Object.assign(new Error(message), response));
2398
1856
  };
2399
1857
  const deserializeAws_restJson1ListCoreDevicesCommand = async (output, context) => {
2400
1858
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2426,51 +1884,25 @@ const deserializeAws_restJson1ListCoreDevicesCommandError = async (output, conte
2426
1884
  switch (errorCode) {
2427
1885
  case "AccessDeniedException":
2428
1886
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2429
- response = {
2430
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2431
- name: errorCode,
2432
- $metadata: deserializeMetadata(output),
2433
- };
2434
- break;
1887
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2435
1888
  case "InternalServerException":
2436
1889
  case "com.amazonaws.greengrassv2#InternalServerException":
2437
- response = {
2438
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2439
- name: errorCode,
2440
- $metadata: deserializeMetadata(output),
2441
- };
2442
- break;
1890
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2443
1891
  case "ThrottlingException":
2444
1892
  case "com.amazonaws.greengrassv2#ThrottlingException":
2445
- response = {
2446
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2447
- name: errorCode,
2448
- $metadata: deserializeMetadata(output),
2449
- };
2450
- break;
1893
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2451
1894
  case "ValidationException":
2452
1895
  case "com.amazonaws.greengrassv2#ValidationException":
2453
- response = {
2454
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2455
- name: errorCode,
2456
- $metadata: deserializeMetadata(output),
2457
- };
2458
- break;
1896
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2459
1897
  default:
2460
1898
  const parsedBody = parsedOutput.body;
2461
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2462
- response = {
2463
- ...parsedBody,
2464
- name: `${errorCode}`,
2465
- message: parsedBody.message || parsedBody.Message || errorCode,
1899
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1900
+ name: parsedBody.code || parsedBody.Code || errorCode,
2466
1901
  $fault: "client",
2467
1902
  $metadata: deserializeMetadata(output),
2468
- };
1903
+ });
1904
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2469
1905
  }
2470
- const message = response.message || response.Message || errorCode;
2471
- response.message = message;
2472
- delete response.Message;
2473
- return Promise.reject(Object.assign(new Error(message), response));
2474
1906
  };
2475
1907
  const deserializeAws_restJson1ListDeploymentsCommand = async (output, context) => {
2476
1908
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2502,51 +1934,25 @@ const deserializeAws_restJson1ListDeploymentsCommandError = async (output, conte
2502
1934
  switch (errorCode) {
2503
1935
  case "AccessDeniedException":
2504
1936
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2505
- response = {
2506
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2507
- name: errorCode,
2508
- $metadata: deserializeMetadata(output),
2509
- };
2510
- break;
1937
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2511
1938
  case "InternalServerException":
2512
1939
  case "com.amazonaws.greengrassv2#InternalServerException":
2513
- response = {
2514
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2515
- name: errorCode,
2516
- $metadata: deserializeMetadata(output),
2517
- };
2518
- break;
1940
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2519
1941
  case "ThrottlingException":
2520
1942
  case "com.amazonaws.greengrassv2#ThrottlingException":
2521
- response = {
2522
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2523
- name: errorCode,
2524
- $metadata: deserializeMetadata(output),
2525
- };
2526
- break;
1943
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2527
1944
  case "ValidationException":
2528
1945
  case "com.amazonaws.greengrassv2#ValidationException":
2529
- response = {
2530
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2531
- name: errorCode,
2532
- $metadata: deserializeMetadata(output),
2533
- };
2534
- break;
1946
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2535
1947
  default:
2536
1948
  const parsedBody = parsedOutput.body;
2537
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2538
- response = {
2539
- ...parsedBody,
2540
- name: `${errorCode}`,
2541
- message: parsedBody.message || parsedBody.Message || errorCode,
1949
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1950
+ name: parsedBody.code || parsedBody.Code || errorCode,
2542
1951
  $fault: "client",
2543
1952
  $metadata: deserializeMetadata(output),
2544
- };
1953
+ });
1954
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2545
1955
  }
2546
- const message = response.message || response.Message || errorCode;
2547
- response.message = message;
2548
- delete response.Message;
2549
- return Promise.reject(Object.assign(new Error(message), response));
2550
1956
  };
2551
1957
  const deserializeAws_restJson1ListEffectiveDeploymentsCommand = async (output, context) => {
2552
1958
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2578,59 +1984,28 @@ const deserializeAws_restJson1ListEffectiveDeploymentsCommandError = async (outp
2578
1984
  switch (errorCode) {
2579
1985
  case "AccessDeniedException":
2580
1986
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2581
- response = {
2582
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2583
- name: errorCode,
2584
- $metadata: deserializeMetadata(output),
2585
- };
2586
- break;
1987
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2587
1988
  case "InternalServerException":
2588
1989
  case "com.amazonaws.greengrassv2#InternalServerException":
2589
- response = {
2590
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2591
- name: errorCode,
2592
- $metadata: deserializeMetadata(output),
2593
- };
2594
- break;
1990
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2595
1991
  case "ResourceNotFoundException":
2596
1992
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2597
- response = {
2598
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2599
- name: errorCode,
2600
- $metadata: deserializeMetadata(output),
2601
- };
2602
- break;
1993
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2603
1994
  case "ThrottlingException":
2604
1995
  case "com.amazonaws.greengrassv2#ThrottlingException":
2605
- response = {
2606
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2607
- name: errorCode,
2608
- $metadata: deserializeMetadata(output),
2609
- };
2610
- break;
1996
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2611
1997
  case "ValidationException":
2612
1998
  case "com.amazonaws.greengrassv2#ValidationException":
2613
- response = {
2614
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2615
- name: errorCode,
2616
- $metadata: deserializeMetadata(output),
2617
- };
2618
- break;
1999
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2619
2000
  default:
2620
2001
  const parsedBody = parsedOutput.body;
2621
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2622
- response = {
2623
- ...parsedBody,
2624
- name: `${errorCode}`,
2625
- message: parsedBody.message || parsedBody.Message || errorCode,
2002
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2003
+ name: parsedBody.code || parsedBody.Code || errorCode,
2626
2004
  $fault: "client",
2627
2005
  $metadata: deserializeMetadata(output),
2628
- };
2006
+ });
2007
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2629
2008
  }
2630
- const message = response.message || response.Message || errorCode;
2631
- response.message = message;
2632
- delete response.Message;
2633
- return Promise.reject(Object.assign(new Error(message), response));
2634
2009
  };
2635
2010
  const deserializeAws_restJson1ListInstalledComponentsCommand = async (output, context) => {
2636
2011
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2662,59 +2037,28 @@ const deserializeAws_restJson1ListInstalledComponentsCommandError = async (outpu
2662
2037
  switch (errorCode) {
2663
2038
  case "AccessDeniedException":
2664
2039
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2665
- response = {
2666
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2667
- name: errorCode,
2668
- $metadata: deserializeMetadata(output),
2669
- };
2670
- break;
2040
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2671
2041
  case "InternalServerException":
2672
2042
  case "com.amazonaws.greengrassv2#InternalServerException":
2673
- response = {
2674
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2675
- name: errorCode,
2676
- $metadata: deserializeMetadata(output),
2677
- };
2678
- break;
2043
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2679
2044
  case "ResourceNotFoundException":
2680
2045
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2681
- response = {
2682
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2683
- name: errorCode,
2684
- $metadata: deserializeMetadata(output),
2685
- };
2686
- break;
2046
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2687
2047
  case "ThrottlingException":
2688
2048
  case "com.amazonaws.greengrassv2#ThrottlingException":
2689
- response = {
2690
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2691
- name: errorCode,
2692
- $metadata: deserializeMetadata(output),
2693
- };
2694
- break;
2049
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2695
2050
  case "ValidationException":
2696
2051
  case "com.amazonaws.greengrassv2#ValidationException":
2697
- response = {
2698
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2699
- name: errorCode,
2700
- $metadata: deserializeMetadata(output),
2701
- };
2702
- break;
2052
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2703
2053
  default:
2704
2054
  const parsedBody = parsedOutput.body;
2705
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2706
- response = {
2707
- ...parsedBody,
2708
- name: `${errorCode}`,
2709
- message: parsedBody.message || parsedBody.Message || errorCode,
2055
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2056
+ name: parsedBody.code || parsedBody.Code || errorCode,
2710
2057
  $fault: "client",
2711
2058
  $metadata: deserializeMetadata(output),
2712
- };
2059
+ });
2060
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2713
2061
  }
2714
- const message = response.message || response.Message || errorCode;
2715
- response.message = message;
2716
- delete response.Message;
2717
- return Promise.reject(Object.assign(new Error(message), response));
2718
2062
  };
2719
2063
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2720
2064
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2742,43 +2086,22 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2742
2086
  switch (errorCode) {
2743
2087
  case "InternalServerException":
2744
2088
  case "com.amazonaws.greengrassv2#InternalServerException":
2745
- response = {
2746
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2747
- name: errorCode,
2748
- $metadata: deserializeMetadata(output),
2749
- };
2750
- break;
2089
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2751
2090
  case "ResourceNotFoundException":
2752
2091
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2753
- response = {
2754
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2755
- name: errorCode,
2756
- $metadata: deserializeMetadata(output),
2757
- };
2758
- break;
2092
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2759
2093
  case "ValidationException":
2760
2094
  case "com.amazonaws.greengrassv2#ValidationException":
2761
- response = {
2762
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2763
- name: errorCode,
2764
- $metadata: deserializeMetadata(output),
2765
- };
2766
- break;
2095
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2767
2096
  default:
2768
2097
  const parsedBody = parsedOutput.body;
2769
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2770
- response = {
2771
- ...parsedBody,
2772
- name: `${errorCode}`,
2773
- message: parsedBody.message || parsedBody.Message || errorCode,
2098
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2099
+ name: parsedBody.code || parsedBody.Code || errorCode,
2774
2100
  $fault: "client",
2775
2101
  $metadata: deserializeMetadata(output),
2776
- };
2102
+ });
2103
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2777
2104
  }
2778
- const message = response.message || response.Message || errorCode;
2779
- response.message = message;
2780
- delete response.Message;
2781
- return Promise.reject(Object.assign(new Error(message), response));
2782
2105
  };
2783
2106
  const deserializeAws_restJson1ResolveComponentCandidatesCommand = async (output, context) => {
2784
2107
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2806,67 +2129,31 @@ const deserializeAws_restJson1ResolveComponentCandidatesCommandError = async (ou
2806
2129
  switch (errorCode) {
2807
2130
  case "AccessDeniedException":
2808
2131
  case "com.amazonaws.greengrassv2#AccessDeniedException":
2809
- response = {
2810
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2811
- name: errorCode,
2812
- $metadata: deserializeMetadata(output),
2813
- };
2814
- break;
2132
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2815
2133
  case "ConflictException":
2816
2134
  case "com.amazonaws.greengrassv2#ConflictException":
2817
- response = {
2818
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2819
- name: errorCode,
2820
- $metadata: deserializeMetadata(output),
2821
- };
2822
- break;
2135
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2823
2136
  case "InternalServerException":
2824
2137
  case "com.amazonaws.greengrassv2#InternalServerException":
2825
- response = {
2826
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2827
- name: errorCode,
2828
- $metadata: deserializeMetadata(output),
2829
- };
2830
- break;
2138
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2831
2139
  case "ResourceNotFoundException":
2832
2140
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2833
- response = {
2834
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2835
- name: errorCode,
2836
- $metadata: deserializeMetadata(output),
2837
- };
2838
- break;
2141
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2839
2142
  case "ThrottlingException":
2840
2143
  case "com.amazonaws.greengrassv2#ThrottlingException":
2841
- response = {
2842
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2843
- name: errorCode,
2844
- $metadata: deserializeMetadata(output),
2845
- };
2846
- break;
2144
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2847
2145
  case "ValidationException":
2848
2146
  case "com.amazonaws.greengrassv2#ValidationException":
2849
- response = {
2850
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2851
- name: errorCode,
2852
- $metadata: deserializeMetadata(output),
2853
- };
2854
- break;
2147
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2855
2148
  default:
2856
2149
  const parsedBody = parsedOutput.body;
2857
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2858
- response = {
2859
- ...parsedBody,
2860
- name: `${errorCode}`,
2861
- message: parsedBody.message || parsedBody.Message || errorCode,
2150
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2151
+ name: parsedBody.code || parsedBody.Code || errorCode,
2862
2152
  $fault: "client",
2863
2153
  $metadata: deserializeMetadata(output),
2864
- };
2154
+ });
2155
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2865
2156
  }
2866
- const message = response.message || response.Message || errorCode;
2867
- response.message = message;
2868
- delete response.Message;
2869
- return Promise.reject(Object.assign(new Error(message), response));
2870
2157
  };
2871
2158
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2872
2159
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2890,43 +2177,22 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2890
2177
  switch (errorCode) {
2891
2178
  case "InternalServerException":
2892
2179
  case "com.amazonaws.greengrassv2#InternalServerException":
2893
- response = {
2894
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2895
- name: errorCode,
2896
- $metadata: deserializeMetadata(output),
2897
- };
2898
- break;
2180
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2899
2181
  case "ResourceNotFoundException":
2900
2182
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2901
- response = {
2902
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2903
- name: errorCode,
2904
- $metadata: deserializeMetadata(output),
2905
- };
2906
- break;
2183
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2907
2184
  case "ValidationException":
2908
2185
  case "com.amazonaws.greengrassv2#ValidationException":
2909
- response = {
2910
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2911
- name: errorCode,
2912
- $metadata: deserializeMetadata(output),
2913
- };
2914
- break;
2186
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2915
2187
  default:
2916
2188
  const parsedBody = parsedOutput.body;
2917
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2918
- response = {
2919
- ...parsedBody,
2920
- name: `${errorCode}`,
2921
- message: parsedBody.message || parsedBody.Message || errorCode,
2189
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2190
+ name: parsedBody.code || parsedBody.Code || errorCode,
2922
2191
  $fault: "client",
2923
2192
  $metadata: deserializeMetadata(output),
2924
- };
2193
+ });
2194
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2925
2195
  }
2926
- const message = response.message || response.Message || errorCode;
2927
- response.message = message;
2928
- delete response.Message;
2929
- return Promise.reject(Object.assign(new Error(message), response));
2930
2196
  };
2931
2197
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2932
2198
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2950,43 +2216,22 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2950
2216
  switch (errorCode) {
2951
2217
  case "InternalServerException":
2952
2218
  case "com.amazonaws.greengrassv2#InternalServerException":
2953
- response = {
2954
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2955
- name: errorCode,
2956
- $metadata: deserializeMetadata(output),
2957
- };
2958
- break;
2219
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2959
2220
  case "ResourceNotFoundException":
2960
2221
  case "com.amazonaws.greengrassv2#ResourceNotFoundException":
2961
- response = {
2962
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2963
- name: errorCode,
2964
- $metadata: deserializeMetadata(output),
2965
- };
2966
- break;
2222
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2967
2223
  case "ValidationException":
2968
2224
  case "com.amazonaws.greengrassv2#ValidationException":
2969
- response = {
2970
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2971
- name: errorCode,
2972
- $metadata: deserializeMetadata(output),
2973
- };
2974
- break;
2225
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2975
2226
  default:
2976
2227
  const parsedBody = parsedOutput.body;
2977
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2978
- response = {
2979
- ...parsedBody,
2980
- name: `${errorCode}`,
2981
- message: parsedBody.message || parsedBody.Message || errorCode,
2228
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2229
+ name: parsedBody.code || parsedBody.Code || errorCode,
2982
2230
  $fault: "client",
2983
2231
  $metadata: deserializeMetadata(output),
2984
- };
2232
+ });
2233
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2985
2234
  }
2986
- const message = response.message || response.Message || errorCode;
2987
- response.message = message;
2988
- delete response.Message;
2989
- return Promise.reject(Object.assign(new Error(message), response));
2990
2235
  };
2991
2236
  const deserializeAws_restJson1UpdateConnectivityInfoCommand = async (output, context) => {
2992
2237
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3018,58 +2263,34 @@ const deserializeAws_restJson1UpdateConnectivityInfoCommandError = async (output
3018
2263
  switch (errorCode) {
3019
2264
  case "InternalServerException":
3020
2265
  case "com.amazonaws.greengrassv2#InternalServerException":
3021
- response = {
3022
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
3023
- name: errorCode,
3024
- $metadata: deserializeMetadata(output),
3025
- };
3026
- break;
2266
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
3027
2267
  case "ValidationException":
3028
2268
  case "com.amazonaws.greengrassv2#ValidationException":
3029
- response = {
3030
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3031
- name: errorCode,
3032
- $metadata: deserializeMetadata(output),
3033
- };
3034
- break;
2269
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3035
2270
  default:
3036
2271
  const parsedBody = parsedOutput.body;
3037
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3038
- response = {
3039
- ...parsedBody,
3040
- name: `${errorCode}`,
3041
- message: parsedBody.message || parsedBody.Message || errorCode,
2272
+ response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2273
+ name: parsedBody.code || parsedBody.Code || errorCode,
3042
2274
  $fault: "client",
3043
2275
  $metadata: deserializeMetadata(output),
3044
- };
2276
+ });
2277
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3045
2278
  }
3046
- const message = response.message || response.Message || errorCode;
3047
- response.message = message;
3048
- delete response.Message;
3049
- return Promise.reject(Object.assign(new Error(message), response));
3050
2279
  };
3051
2280
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
3052
- const contents = {
3053
- name: "AccessDeniedException",
3054
- $fault: "client",
3055
- $metadata: deserializeMetadata(parsedOutput),
3056
- message: undefined,
3057
- };
2281
+ const contents = {};
3058
2282
  const data = parsedOutput.body;
3059
2283
  if (data.message !== undefined && data.message !== null) {
3060
2284
  contents.message = smithy_client_1.expectString(data.message);
3061
2285
  }
3062
- return contents;
2286
+ const exception = new models_0_1.AccessDeniedException({
2287
+ $metadata: deserializeMetadata(parsedOutput),
2288
+ ...contents,
2289
+ });
2290
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3063
2291
  };
3064
2292
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3065
- const contents = {
3066
- name: "ConflictException",
3067
- $fault: "client",
3068
- $metadata: deserializeMetadata(parsedOutput),
3069
- message: undefined,
3070
- resourceId: undefined,
3071
- resourceType: undefined,
3072
- };
2293
+ const contents = {};
3073
2294
  const data = parsedOutput.body;
3074
2295
  if (data.message !== undefined && data.message !== null) {
3075
2296
  contents.message = smithy_client_1.expectString(data.message);
@@ -3080,16 +2301,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3080
2301
  if (data.resourceType !== undefined && data.resourceType !== null) {
3081
2302
  contents.resourceType = smithy_client_1.expectString(data.resourceType);
3082
2303
  }
3083
- return contents;
2304
+ const exception = new models_0_1.ConflictException({
2305
+ $metadata: deserializeMetadata(parsedOutput),
2306
+ ...contents,
2307
+ });
2308
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3084
2309
  };
3085
2310
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
3086
- const contents = {
3087
- name: "InternalServerException",
3088
- $fault: "server",
3089
- $metadata: deserializeMetadata(parsedOutput),
3090
- message: undefined,
3091
- retryAfterSeconds: undefined,
3092
- };
2311
+ const contents = {};
3093
2312
  if (parsedOutput.headers["retry-after"] !== undefined) {
3094
2313
  contents.retryAfterSeconds = smithy_client_1.strictParseInt32(parsedOutput.headers["retry-after"]);
3095
2314
  }
@@ -3097,30 +2316,26 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
3097
2316
  if (data.message !== undefined && data.message !== null) {
3098
2317
  contents.message = smithy_client_1.expectString(data.message);
3099
2318
  }
3100
- return contents;
2319
+ const exception = new models_0_1.InternalServerException({
2320
+ $metadata: deserializeMetadata(parsedOutput),
2321
+ ...contents,
2322
+ });
2323
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3101
2324
  };
3102
2325
  const deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse = async (parsedOutput, context) => {
3103
- const contents = {
3104
- name: "RequestAlreadyInProgressException",
3105
- $fault: "client",
3106
- $metadata: deserializeMetadata(parsedOutput),
3107
- message: undefined,
3108
- };
2326
+ const contents = {};
3109
2327
  const data = parsedOutput.body;
3110
2328
  if (data.message !== undefined && data.message !== null) {
3111
2329
  contents.message = smithy_client_1.expectString(data.message);
3112
2330
  }
3113
- return contents;
2331
+ const exception = new models_0_1.RequestAlreadyInProgressException({
2332
+ $metadata: deserializeMetadata(parsedOutput),
2333
+ ...contents,
2334
+ });
2335
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3114
2336
  };
3115
2337
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3116
- const contents = {
3117
- name: "ResourceNotFoundException",
3118
- $fault: "client",
3119
- $metadata: deserializeMetadata(parsedOutput),
3120
- message: undefined,
3121
- resourceId: undefined,
3122
- resourceType: undefined,
3123
- };
2338
+ const contents = {};
3124
2339
  const data = parsedOutput.body;
3125
2340
  if (data.message !== undefined && data.message !== null) {
3126
2341
  contents.message = smithy_client_1.expectString(data.message);
@@ -3131,19 +2346,14 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3131
2346
  if (data.resourceType !== undefined && data.resourceType !== null) {
3132
2347
  contents.resourceType = smithy_client_1.expectString(data.resourceType);
3133
2348
  }
3134
- return contents;
2349
+ const exception = new models_0_1.ResourceNotFoundException({
2350
+ $metadata: deserializeMetadata(parsedOutput),
2351
+ ...contents,
2352
+ });
2353
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3135
2354
  };
3136
2355
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
3137
- const contents = {
3138
- name: "ServiceQuotaExceededException",
3139
- $fault: "client",
3140
- $metadata: deserializeMetadata(parsedOutput),
3141
- message: undefined,
3142
- quotaCode: undefined,
3143
- resourceId: undefined,
3144
- resourceType: undefined,
3145
- serviceCode: undefined,
3146
- };
2356
+ const contents = {};
3147
2357
  const data = parsedOutput.body;
3148
2358
  if (data.message !== undefined && data.message !== null) {
3149
2359
  contents.message = smithy_client_1.expectString(data.message);
@@ -3160,18 +2370,14 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
3160
2370
  if (data.serviceCode !== undefined && data.serviceCode !== null) {
3161
2371
  contents.serviceCode = smithy_client_1.expectString(data.serviceCode);
3162
2372
  }
3163
- return contents;
2373
+ const exception = new models_0_1.ServiceQuotaExceededException({
2374
+ $metadata: deserializeMetadata(parsedOutput),
2375
+ ...contents,
2376
+ });
2377
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3164
2378
  };
3165
2379
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
3166
- const contents = {
3167
- name: "ThrottlingException",
3168
- $fault: "client",
3169
- $metadata: deserializeMetadata(parsedOutput),
3170
- message: undefined,
3171
- quotaCode: undefined,
3172
- retryAfterSeconds: undefined,
3173
- serviceCode: undefined,
3174
- };
2380
+ const contents = {};
3175
2381
  if (parsedOutput.headers["retry-after"] !== undefined) {
3176
2382
  contents.retryAfterSeconds = smithy_client_1.strictParseInt32(parsedOutput.headers["retry-after"]);
3177
2383
  }
@@ -3185,17 +2391,14 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
3185
2391
  if (data.serviceCode !== undefined && data.serviceCode !== null) {
3186
2392
  contents.serviceCode = smithy_client_1.expectString(data.serviceCode);
3187
2393
  }
3188
- return contents;
2394
+ const exception = new models_0_1.ThrottlingException({
2395
+ $metadata: deserializeMetadata(parsedOutput),
2396
+ ...contents,
2397
+ });
2398
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3189
2399
  };
3190
2400
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
3191
- const contents = {
3192
- name: "ValidationException",
3193
- $fault: "client",
3194
- $metadata: deserializeMetadata(parsedOutput),
3195
- fields: undefined,
3196
- message: undefined,
3197
- reason: undefined,
3198
- };
2401
+ const contents = {};
3199
2402
  const data = parsedOutput.body;
3200
2403
  if (data.fields !== undefined && data.fields !== null) {
3201
2404
  contents.fields = deserializeAws_restJson1ValidationExceptionFieldList(data.fields, context);
@@ -3206,7 +2409,11 @@ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput,
3206
2409
  if (data.reason !== undefined && data.reason !== null) {
3207
2410
  contents.reason = smithy_client_1.expectString(data.reason);
3208
2411
  }
3209
- return contents;
2412
+ const exception = new models_0_1.ValidationException({
2413
+ $metadata: deserializeMetadata(parsedOutput),
2414
+ ...contents,
2415
+ });
2416
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3210
2417
  };
3211
2418
  const serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntry = (input, context) => {
3212
2419
  return {
@@ -3662,7 +2869,7 @@ const deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorEntry = (o
3662
2869
  };
3663
2870
  };
3664
2871
  const deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorList = (output, context) => {
3665
- return (output || [])
2872
+ const retVal = (output || [])
3666
2873
  .filter((e) => e != null)
3667
2874
  .map((entry) => {
3668
2875
  if (entry === null) {
@@ -3670,6 +2877,7 @@ const deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorList = (ou
3670
2877
  }
3671
2878
  return deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorEntry(entry, context);
3672
2879
  });
2880
+ return retVal;
3673
2881
  };
3674
2882
  const deserializeAws_restJson1AssociatedClientDevice = (output, context) => {
3675
2883
  return {
@@ -3680,7 +2888,7 @@ const deserializeAws_restJson1AssociatedClientDevice = (output, context) => {
3680
2888
  };
3681
2889
  };
3682
2890
  const deserializeAws_restJson1AssociatedClientDeviceList = (output, context) => {
3683
- return (output || [])
2891
+ const retVal = (output || [])
3684
2892
  .filter((e) => e != null)
3685
2893
  .map((entry) => {
3686
2894
  if (entry === null) {
@@ -3688,6 +2896,7 @@ const deserializeAws_restJson1AssociatedClientDeviceList = (output, context) =>
3688
2896
  }
3689
2897
  return deserializeAws_restJson1AssociatedClientDevice(entry, context);
3690
2898
  });
2899
+ return retVal;
3691
2900
  };
3692
2901
  const deserializeAws_restJson1CloudComponentStatus = (output, context) => {
3693
2902
  return {
@@ -3708,7 +2917,7 @@ const deserializeAws_restJson1Component = (output, context) => {
3708
2917
  };
3709
2918
  };
3710
2919
  const deserializeAws_restJson1ComponentConfigurationPathList = (output, context) => {
3711
- return (output || [])
2920
+ const retVal = (output || [])
3712
2921
  .filter((e) => e != null)
3713
2922
  .map((entry) => {
3714
2923
  if (entry === null) {
@@ -3716,6 +2925,7 @@ const deserializeAws_restJson1ComponentConfigurationPathList = (output, context)
3716
2925
  }
3717
2926
  return smithy_client_1.expectString(entry);
3718
2927
  });
2928
+ return retVal;
3719
2929
  };
3720
2930
  const deserializeAws_restJson1ComponentConfigurationUpdate = (output, context) => {
3721
2931
  return {
@@ -3762,7 +2972,7 @@ const deserializeAws_restJson1ComponentLatestVersion = (output, context) => {
3762
2972
  };
3763
2973
  };
3764
2974
  const deserializeAws_restJson1ComponentList = (output, context) => {
3765
- return (output || [])
2975
+ const retVal = (output || [])
3766
2976
  .filter((e) => e != null)
3767
2977
  .map((entry) => {
3768
2978
  if (entry === null) {
@@ -3770,6 +2980,7 @@ const deserializeAws_restJson1ComponentList = (output, context) => {
3770
2980
  }
3771
2981
  return deserializeAws_restJson1Component(entry, context);
3772
2982
  });
2983
+ return retVal;
3773
2984
  };
3774
2985
  const deserializeAws_restJson1ComponentPlatform = (output, context) => {
3775
2986
  return {
@@ -3780,7 +2991,7 @@ const deserializeAws_restJson1ComponentPlatform = (output, context) => {
3780
2991
  };
3781
2992
  };
3782
2993
  const deserializeAws_restJson1ComponentPlatformList = (output, context) => {
3783
- return (output || [])
2994
+ const retVal = (output || [])
3784
2995
  .filter((e) => e != null)
3785
2996
  .map((entry) => {
3786
2997
  if (entry === null) {
@@ -3788,6 +2999,7 @@ const deserializeAws_restJson1ComponentPlatformList = (output, context) => {
3788
2999
  }
3789
3000
  return deserializeAws_restJson1ComponentPlatform(entry, context);
3790
3001
  });
3002
+ return retVal;
3791
3003
  };
3792
3004
  const deserializeAws_restJson1ComponentRunWith = (output, context) => {
3793
3005
  return {
@@ -3799,7 +3011,7 @@ const deserializeAws_restJson1ComponentRunWith = (output, context) => {
3799
3011
  };
3800
3012
  };
3801
3013
  const deserializeAws_restJson1ComponentVersionList = (output, context) => {
3802
- return (output || [])
3014
+ const retVal = (output || [])
3803
3015
  .filter((e) => e != null)
3804
3016
  .map((entry) => {
3805
3017
  if (entry === null) {
@@ -3807,6 +3019,7 @@ const deserializeAws_restJson1ComponentVersionList = (output, context) => {
3807
3019
  }
3808
3020
  return deserializeAws_restJson1ComponentVersionListItem(entry, context);
3809
3021
  });
3022
+ return retVal;
3810
3023
  };
3811
3024
  const deserializeAws_restJson1ComponentVersionListItem = (output, context) => {
3812
3025
  return {
@@ -3824,7 +3037,7 @@ const deserializeAws_restJson1ConnectivityInfo = (output, context) => {
3824
3037
  };
3825
3038
  };
3826
3039
  const deserializeAws_restJson1connectivityInfoList = (output, context) => {
3827
- return (output || [])
3040
+ const retVal = (output || [])
3828
3041
  .filter((e) => e != null)
3829
3042
  .map((entry) => {
3830
3043
  if (entry === null) {
@@ -3832,6 +3045,7 @@ const deserializeAws_restJson1connectivityInfoList = (output, context) => {
3832
3045
  }
3833
3046
  return deserializeAws_restJson1ConnectivityInfo(entry, context);
3834
3047
  });
3048
+ return retVal;
3835
3049
  };
3836
3050
  const deserializeAws_restJson1CoreDevice = (output, context) => {
3837
3051
  return {
@@ -3843,7 +3057,7 @@ const deserializeAws_restJson1CoreDevice = (output, context) => {
3843
3057
  };
3844
3058
  };
3845
3059
  const deserializeAws_restJson1CoreDevicesList = (output, context) => {
3846
- return (output || [])
3060
+ const retVal = (output || [])
3847
3061
  .filter((e) => e != null)
3848
3062
  .map((entry) => {
3849
3063
  if (entry === null) {
@@ -3851,6 +3065,7 @@ const deserializeAws_restJson1CoreDevicesList = (output, context) => {
3851
3065
  }
3852
3066
  return deserializeAws_restJson1CoreDevice(entry, context);
3853
3067
  });
3068
+ return retVal;
3854
3069
  };
3855
3070
  const deserializeAws_restJson1Deployment = (output, context) => {
3856
3071
  return {
@@ -3890,7 +3105,7 @@ const deserializeAws_restJson1DeploymentIoTJobConfiguration = (output, context)
3890
3105
  };
3891
3106
  };
3892
3107
  const deserializeAws_restJson1DeploymentList = (output, context) => {
3893
- return (output || [])
3108
+ const retVal = (output || [])
3894
3109
  .filter((e) => e != null)
3895
3110
  .map((entry) => {
3896
3111
  if (entry === null) {
@@ -3898,6 +3113,7 @@ const deserializeAws_restJson1DeploymentList = (output, context) => {
3898
3113
  }
3899
3114
  return deserializeAws_restJson1Deployment(entry, context);
3900
3115
  });
3116
+ return retVal;
3901
3117
  };
3902
3118
  const deserializeAws_restJson1DeploymentPolicies = (output, context) => {
3903
3119
  return {
@@ -3918,7 +3134,7 @@ const deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorEntry =
3918
3134
  };
3919
3135
  };
3920
3136
  const deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorList = (output, context) => {
3921
- return (output || [])
3137
+ const retVal = (output || [])
3922
3138
  .filter((e) => e != null)
3923
3139
  .map((entry) => {
3924
3140
  if (entry === null) {
@@ -3926,6 +3142,7 @@ const deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorList =
3926
3142
  }
3927
3143
  return deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorEntry(entry, context);
3928
3144
  });
3145
+ return retVal;
3929
3146
  };
3930
3147
  const deserializeAws_restJson1EffectiveDeployment = (output, context) => {
3931
3148
  return {
@@ -3946,7 +3163,7 @@ const deserializeAws_restJson1EffectiveDeployment = (output, context) => {
3946
3163
  };
3947
3164
  };
3948
3165
  const deserializeAws_restJson1EffectiveDeploymentsList = (output, context) => {
3949
- return (output || [])
3166
+ const retVal = (output || [])
3950
3167
  .filter((e) => e != null)
3951
3168
  .map((entry) => {
3952
3169
  if (entry === null) {
@@ -3954,6 +3171,7 @@ const deserializeAws_restJson1EffectiveDeploymentsList = (output, context) => {
3954
3171
  }
3955
3172
  return deserializeAws_restJson1EffectiveDeployment(entry, context);
3956
3173
  });
3174
+ return retVal;
3957
3175
  };
3958
3176
  const deserializeAws_restJson1InstalledComponent = (output, context) => {
3959
3177
  return {
@@ -3965,7 +3183,7 @@ const deserializeAws_restJson1InstalledComponent = (output, context) => {
3965
3183
  };
3966
3184
  };
3967
3185
  const deserializeAws_restJson1InstalledComponentList = (output, context) => {
3968
- return (output || [])
3186
+ const retVal = (output || [])
3969
3187
  .filter((e) => e != null)
3970
3188
  .map((entry) => {
3971
3189
  if (entry === null) {
@@ -3973,6 +3191,7 @@ const deserializeAws_restJson1InstalledComponentList = (output, context) => {
3973
3191
  }
3974
3192
  return deserializeAws_restJson1InstalledComponent(entry, context);
3975
3193
  });
3194
+ return retVal;
3976
3195
  };
3977
3196
  const deserializeAws_restJson1IoTJobAbortConfig = (output, context) => {
3978
3197
  return {
@@ -3990,7 +3209,7 @@ const deserializeAws_restJson1IoTJobAbortCriteria = (output, context) => {
3990
3209
  };
3991
3210
  };
3992
3211
  const deserializeAws_restJson1IoTJobAbortCriteriaList = (output, context) => {
3993
- return (output || [])
3212
+ const retVal = (output || [])
3994
3213
  .filter((e) => e != null)
3995
3214
  .map((entry) => {
3996
3215
  if (entry === null) {
@@ -3998,6 +3217,7 @@ const deserializeAws_restJson1IoTJobAbortCriteriaList = (output, context) => {
3998
3217
  }
3999
3218
  return deserializeAws_restJson1IoTJobAbortCriteria(entry, context);
4000
3219
  });
3220
+ return retVal;
4001
3221
  };
4002
3222
  const deserializeAws_restJson1IoTJobExecutionsRolloutConfig = (output, context) => {
4003
3223
  return {
@@ -4047,7 +3267,7 @@ const deserializeAws_restJson1ResolvedComponentVersion = (output, context) => {
4047
3267
  };
4048
3268
  };
4049
3269
  const deserializeAws_restJson1ResolvedComponentVersionsList = (output, context) => {
4050
- return (output || [])
3270
+ const retVal = (output || [])
4051
3271
  .filter((e) => e != null)
4052
3272
  .map((entry) => {
4053
3273
  if (entry === null) {
@@ -4055,6 +3275,7 @@ const deserializeAws_restJson1ResolvedComponentVersionsList = (output, context)
4055
3275
  }
4056
3276
  return deserializeAws_restJson1ResolvedComponentVersion(entry, context);
4057
3277
  });
3278
+ return retVal;
4058
3279
  };
4059
3280
  const deserializeAws_restJson1StringMap = (output, context) => {
4060
3281
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -4091,7 +3312,7 @@ const deserializeAws_restJson1ValidationExceptionField = (output, context) => {
4091
3312
  };
4092
3313
  };
4093
3314
  const deserializeAws_restJson1ValidationExceptionFieldList = (output, context) => {
4094
- return (output || [])
3315
+ const retVal = (output || [])
4095
3316
  .filter((e) => e != null)
4096
3317
  .map((entry) => {
4097
3318
  if (entry === null) {
@@ -4099,6 +3320,7 @@ const deserializeAws_restJson1ValidationExceptionFieldList = (output, context) =
4099
3320
  }
4100
3321
  return deserializeAws_restJson1ValidationExceptionField(entry, context);
4101
3322
  });
3323
+ return retVal;
4102
3324
  };
4103
3325
  const deserializeMetadata = (output) => {
4104
3326
  var _a;