@aws-sdk/client-amplifybackend 3.52.0 → 3.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,8 @@ exports.deserializeAws_restJson1GetBackendStorageCommand = exports.deserializeAw
4
4
  exports.deserializeAws_restJson1UpdateBackendStorageCommand = exports.deserializeAws_restJson1UpdateBackendJobCommand = exports.deserializeAws_restJson1UpdateBackendConfigCommand = exports.deserializeAws_restJson1UpdateBackendAuthCommand = exports.deserializeAws_restJson1UpdateBackendAPICommand = exports.deserializeAws_restJson1RemoveBackendConfigCommand = exports.deserializeAws_restJson1RemoveAllBackendsCommand = exports.deserializeAws_restJson1ListS3BucketsCommand = exports.deserializeAws_restJson1ListBackendJobsCommand = exports.deserializeAws_restJson1ImportBackendStorageCommand = exports.deserializeAws_restJson1ImportBackendAuthCommand = exports.deserializeAws_restJson1GetTokenCommand = void 0;
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
+ const AmplifyBackendServiceException_1 = require("../models/AmplifyBackendServiceException");
8
+ const models_0_1 = require("../models/models_0");
7
9
  const serializeAws_restJson1CloneBackendCommand = async (input, context) => {
8
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
9
11
  const headers = {
@@ -1265,51 +1267,25 @@ const deserializeAws_restJson1CloneBackendCommandError = async (output, context)
1265
1267
  switch (errorCode) {
1266
1268
  case "BadRequestException":
1267
1269
  case "com.amazonaws.amplifybackend#BadRequestException":
1268
- response = {
1269
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1270
- name: errorCode,
1271
- $metadata: deserializeMetadata(output),
1272
- };
1273
- break;
1270
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1274
1271
  case "GatewayTimeoutException":
1275
1272
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1276
- response = {
1277
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1278
- name: errorCode,
1279
- $metadata: deserializeMetadata(output),
1280
- };
1281
- break;
1273
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1282
1274
  case "NotFoundException":
1283
1275
  case "com.amazonaws.amplifybackend#NotFoundException":
1284
- response = {
1285
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1286
- name: errorCode,
1287
- $metadata: deserializeMetadata(output),
1288
- };
1289
- break;
1276
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1290
1277
  case "TooManyRequestsException":
1291
1278
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1292
- response = {
1293
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1294
- name: errorCode,
1295
- $metadata: deserializeMetadata(output),
1296
- };
1297
- break;
1279
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1298
1280
  default:
1299
1281
  const parsedBody = parsedOutput.body;
1300
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1301
- response = {
1302
- ...parsedBody,
1303
- name: `${errorCode}`,
1304
- message: parsedBody.message || parsedBody.Message || errorCode,
1282
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1283
+ name: parsedBody.code || parsedBody.Code || errorCode,
1305
1284
  $fault: "client",
1306
1285
  $metadata: deserializeMetadata(output),
1307
- };
1286
+ });
1287
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1308
1288
  }
1309
- const message = response.message || response.Message || errorCode;
1310
- response.message = message;
1311
- delete response.Message;
1312
- return Promise.reject(Object.assign(new Error(message), response));
1313
1289
  };
1314
1290
  const deserializeAws_restJson1CreateBackendCommand = async (output, context) => {
1315
1291
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1357,51 +1333,25 @@ const deserializeAws_restJson1CreateBackendCommandError = async (output, context
1357
1333
  switch (errorCode) {
1358
1334
  case "BadRequestException":
1359
1335
  case "com.amazonaws.amplifybackend#BadRequestException":
1360
- response = {
1361
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1362
- name: errorCode,
1363
- $metadata: deserializeMetadata(output),
1364
- };
1365
- break;
1336
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1366
1337
  case "GatewayTimeoutException":
1367
1338
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1368
- response = {
1369
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1370
- name: errorCode,
1371
- $metadata: deserializeMetadata(output),
1372
- };
1373
- break;
1339
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1374
1340
  case "NotFoundException":
1375
1341
  case "com.amazonaws.amplifybackend#NotFoundException":
1376
- response = {
1377
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1378
- name: errorCode,
1379
- $metadata: deserializeMetadata(output),
1380
- };
1381
- break;
1342
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1382
1343
  case "TooManyRequestsException":
1383
1344
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1384
- response = {
1385
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1386
- name: errorCode,
1387
- $metadata: deserializeMetadata(output),
1388
- };
1389
- break;
1345
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1390
1346
  default:
1391
1347
  const parsedBody = parsedOutput.body;
1392
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1393
- response = {
1394
- ...parsedBody,
1395
- name: `${errorCode}`,
1396
- message: parsedBody.message || parsedBody.Message || errorCode,
1348
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1349
+ name: parsedBody.code || parsedBody.Code || errorCode,
1397
1350
  $fault: "client",
1398
1351
  $metadata: deserializeMetadata(output),
1399
- };
1352
+ });
1353
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1400
1354
  }
1401
- const message = response.message || response.Message || errorCode;
1402
- response.message = message;
1403
- delete response.Message;
1404
- return Promise.reject(Object.assign(new Error(message), response));
1405
1355
  };
1406
1356
  const deserializeAws_restJson1CreateBackendAPICommand = async (output, context) => {
1407
1357
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1449,51 +1399,25 @@ const deserializeAws_restJson1CreateBackendAPICommandError = async (output, cont
1449
1399
  switch (errorCode) {
1450
1400
  case "BadRequestException":
1451
1401
  case "com.amazonaws.amplifybackend#BadRequestException":
1452
- response = {
1453
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1454
- name: errorCode,
1455
- $metadata: deserializeMetadata(output),
1456
- };
1457
- break;
1402
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1458
1403
  case "GatewayTimeoutException":
1459
1404
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1460
- response = {
1461
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1462
- name: errorCode,
1463
- $metadata: deserializeMetadata(output),
1464
- };
1465
- break;
1405
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1466
1406
  case "NotFoundException":
1467
1407
  case "com.amazonaws.amplifybackend#NotFoundException":
1468
- response = {
1469
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1470
- name: errorCode,
1471
- $metadata: deserializeMetadata(output),
1472
- };
1473
- break;
1408
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1474
1409
  case "TooManyRequestsException":
1475
1410
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1476
- response = {
1477
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1478
- name: errorCode,
1479
- $metadata: deserializeMetadata(output),
1480
- };
1481
- break;
1411
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1482
1412
  default:
1483
1413
  const parsedBody = parsedOutput.body;
1484
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1485
- response = {
1486
- ...parsedBody,
1487
- name: `${errorCode}`,
1488
- message: parsedBody.message || parsedBody.Message || errorCode,
1414
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1415
+ name: parsedBody.code || parsedBody.Code || errorCode,
1489
1416
  $fault: "client",
1490
1417
  $metadata: deserializeMetadata(output),
1491
- };
1418
+ });
1419
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1492
1420
  }
1493
- const message = response.message || response.Message || errorCode;
1494
- response.message = message;
1495
- delete response.Message;
1496
- return Promise.reject(Object.assign(new Error(message), response));
1497
1421
  };
1498
1422
  const deserializeAws_restJson1CreateBackendAuthCommand = async (output, context) => {
1499
1423
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1541,51 +1465,25 @@ const deserializeAws_restJson1CreateBackendAuthCommandError = async (output, con
1541
1465
  switch (errorCode) {
1542
1466
  case "BadRequestException":
1543
1467
  case "com.amazonaws.amplifybackend#BadRequestException":
1544
- response = {
1545
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1546
- name: errorCode,
1547
- $metadata: deserializeMetadata(output),
1548
- };
1549
- break;
1468
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1550
1469
  case "GatewayTimeoutException":
1551
1470
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1552
- response = {
1553
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1554
- name: errorCode,
1555
- $metadata: deserializeMetadata(output),
1556
- };
1557
- break;
1471
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1558
1472
  case "NotFoundException":
1559
1473
  case "com.amazonaws.amplifybackend#NotFoundException":
1560
- response = {
1561
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1562
- name: errorCode,
1563
- $metadata: deserializeMetadata(output),
1564
- };
1565
- break;
1474
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1566
1475
  case "TooManyRequestsException":
1567
1476
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1568
- response = {
1569
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1570
- name: errorCode,
1571
- $metadata: deserializeMetadata(output),
1572
- };
1573
- break;
1477
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1574
1478
  default:
1575
1479
  const parsedBody = parsedOutput.body;
1576
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1577
- response = {
1578
- ...parsedBody,
1579
- name: `${errorCode}`,
1580
- message: parsedBody.message || parsedBody.Message || errorCode,
1480
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1481
+ name: parsedBody.code || parsedBody.Code || errorCode,
1581
1482
  $fault: "client",
1582
1483
  $metadata: deserializeMetadata(output),
1583
- };
1484
+ });
1485
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1584
1486
  }
1585
- const message = response.message || response.Message || errorCode;
1586
- response.message = message;
1587
- delete response.Message;
1588
- return Promise.reject(Object.assign(new Error(message), response));
1589
1487
  };
1590
1488
  const deserializeAws_restJson1CreateBackendConfigCommand = async (output, context) => {
1591
1489
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1625,51 +1523,25 @@ const deserializeAws_restJson1CreateBackendConfigCommandError = async (output, c
1625
1523
  switch (errorCode) {
1626
1524
  case "BadRequestException":
1627
1525
  case "com.amazonaws.amplifybackend#BadRequestException":
1628
- response = {
1629
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1630
- name: errorCode,
1631
- $metadata: deserializeMetadata(output),
1632
- };
1633
- break;
1526
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1634
1527
  case "GatewayTimeoutException":
1635
1528
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1636
- response = {
1637
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1638
- name: errorCode,
1639
- $metadata: deserializeMetadata(output),
1640
- };
1641
- break;
1529
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1642
1530
  case "NotFoundException":
1643
1531
  case "com.amazonaws.amplifybackend#NotFoundException":
1644
- response = {
1645
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1646
- name: errorCode,
1647
- $metadata: deserializeMetadata(output),
1648
- };
1649
- break;
1532
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1650
1533
  case "TooManyRequestsException":
1651
1534
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1652
- response = {
1653
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1654
- name: errorCode,
1655
- $metadata: deserializeMetadata(output),
1656
- };
1657
- break;
1535
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1658
1536
  default:
1659
1537
  const parsedBody = parsedOutput.body;
1660
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1661
- response = {
1662
- ...parsedBody,
1663
- name: `${errorCode}`,
1664
- message: parsedBody.message || parsedBody.Message || errorCode,
1538
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1539
+ name: parsedBody.code || parsedBody.Code || errorCode,
1665
1540
  $fault: "client",
1666
1541
  $metadata: deserializeMetadata(output),
1667
- };
1542
+ });
1543
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1668
1544
  }
1669
- const message = response.message || response.Message || errorCode;
1670
- response.message = message;
1671
- delete response.Message;
1672
- return Promise.reject(Object.assign(new Error(message), response));
1673
1545
  };
1674
1546
  const deserializeAws_restJson1CreateBackendStorageCommand = async (output, context) => {
1675
1547
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1709,51 +1581,25 @@ const deserializeAws_restJson1CreateBackendStorageCommandError = async (output,
1709
1581
  switch (errorCode) {
1710
1582
  case "BadRequestException":
1711
1583
  case "com.amazonaws.amplifybackend#BadRequestException":
1712
- response = {
1713
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1714
- name: errorCode,
1715
- $metadata: deserializeMetadata(output),
1716
- };
1717
- break;
1584
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1718
1585
  case "GatewayTimeoutException":
1719
1586
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1720
- response = {
1721
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1722
- name: errorCode,
1723
- $metadata: deserializeMetadata(output),
1724
- };
1725
- break;
1587
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1726
1588
  case "NotFoundException":
1727
1589
  case "com.amazonaws.amplifybackend#NotFoundException":
1728
- response = {
1729
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1730
- name: errorCode,
1731
- $metadata: deserializeMetadata(output),
1732
- };
1733
- break;
1590
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1734
1591
  case "TooManyRequestsException":
1735
1592
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1736
- response = {
1737
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1738
- name: errorCode,
1739
- $metadata: deserializeMetadata(output),
1740
- };
1741
- break;
1593
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1742
1594
  default:
1743
1595
  const parsedBody = parsedOutput.body;
1744
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1745
- response = {
1746
- ...parsedBody,
1747
- name: `${errorCode}`,
1748
- message: parsedBody.message || parsedBody.Message || errorCode,
1596
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1597
+ name: parsedBody.code || parsedBody.Code || errorCode,
1749
1598
  $fault: "client",
1750
1599
  $metadata: deserializeMetadata(output),
1751
- };
1600
+ });
1601
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1752
1602
  }
1753
- const message = response.message || response.Message || errorCode;
1754
- response.message = message;
1755
- delete response.Message;
1756
- return Promise.reject(Object.assign(new Error(message), response));
1757
1603
  };
1758
1604
  const deserializeAws_restJson1CreateTokenCommand = async (output, context) => {
1759
1605
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1793,51 +1639,25 @@ const deserializeAws_restJson1CreateTokenCommandError = async (output, context)
1793
1639
  switch (errorCode) {
1794
1640
  case "BadRequestException":
1795
1641
  case "com.amazonaws.amplifybackend#BadRequestException":
1796
- response = {
1797
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1798
- name: errorCode,
1799
- $metadata: deserializeMetadata(output),
1800
- };
1801
- break;
1642
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1802
1643
  case "GatewayTimeoutException":
1803
1644
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1804
- response = {
1805
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1806
- name: errorCode,
1807
- $metadata: deserializeMetadata(output),
1808
- };
1809
- break;
1645
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1810
1646
  case "NotFoundException":
1811
1647
  case "com.amazonaws.amplifybackend#NotFoundException":
1812
- response = {
1813
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1814
- name: errorCode,
1815
- $metadata: deserializeMetadata(output),
1816
- };
1817
- break;
1648
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1818
1649
  case "TooManyRequestsException":
1819
1650
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1820
- response = {
1821
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1822
- name: errorCode,
1823
- $metadata: deserializeMetadata(output),
1824
- };
1825
- break;
1651
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1826
1652
  default:
1827
1653
  const parsedBody = parsedOutput.body;
1828
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1829
- response = {
1830
- ...parsedBody,
1831
- name: `${errorCode}`,
1832
- message: parsedBody.message || parsedBody.Message || errorCode,
1654
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1655
+ name: parsedBody.code || parsedBody.Code || errorCode,
1833
1656
  $fault: "client",
1834
1657
  $metadata: deserializeMetadata(output),
1835
- };
1658
+ });
1659
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1836
1660
  }
1837
- const message = response.message || response.Message || errorCode;
1838
- response.message = message;
1839
- delete response.Message;
1840
- return Promise.reject(Object.assign(new Error(message), response));
1841
1661
  };
1842
1662
  const deserializeAws_restJson1DeleteBackendCommand = async (output, context) => {
1843
1663
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1885,51 +1705,25 @@ const deserializeAws_restJson1DeleteBackendCommandError = async (output, context
1885
1705
  switch (errorCode) {
1886
1706
  case "BadRequestException":
1887
1707
  case "com.amazonaws.amplifybackend#BadRequestException":
1888
- response = {
1889
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1890
- name: errorCode,
1891
- $metadata: deserializeMetadata(output),
1892
- };
1893
- break;
1708
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1894
1709
  case "GatewayTimeoutException":
1895
1710
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1896
- response = {
1897
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1898
- name: errorCode,
1899
- $metadata: deserializeMetadata(output),
1900
- };
1901
- break;
1711
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1902
1712
  case "NotFoundException":
1903
1713
  case "com.amazonaws.amplifybackend#NotFoundException":
1904
- response = {
1905
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1906
- name: errorCode,
1907
- $metadata: deserializeMetadata(output),
1908
- };
1909
- break;
1714
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1910
1715
  case "TooManyRequestsException":
1911
1716
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
1912
- response = {
1913
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1914
- name: errorCode,
1915
- $metadata: deserializeMetadata(output),
1916
- };
1917
- break;
1717
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1918
1718
  default:
1919
1719
  const parsedBody = parsedOutput.body;
1920
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1921
- response = {
1922
- ...parsedBody,
1923
- name: `${errorCode}`,
1924
- message: parsedBody.message || parsedBody.Message || errorCode,
1720
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1721
+ name: parsedBody.code || parsedBody.Code || errorCode,
1925
1722
  $fault: "client",
1926
1723
  $metadata: deserializeMetadata(output),
1927
- };
1724
+ });
1725
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1928
1726
  }
1929
- const message = response.message || response.Message || errorCode;
1930
- response.message = message;
1931
- delete response.Message;
1932
- return Promise.reject(Object.assign(new Error(message), response));
1933
1727
  };
1934
1728
  const deserializeAws_restJson1DeleteBackendAPICommand = async (output, context) => {
1935
1729
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1977,51 +1771,25 @@ const deserializeAws_restJson1DeleteBackendAPICommandError = async (output, cont
1977
1771
  switch (errorCode) {
1978
1772
  case "BadRequestException":
1979
1773
  case "com.amazonaws.amplifybackend#BadRequestException":
1980
- response = {
1981
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1982
- name: errorCode,
1983
- $metadata: deserializeMetadata(output),
1984
- };
1985
- break;
1774
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1986
1775
  case "GatewayTimeoutException":
1987
1776
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
1988
- response = {
1989
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
1990
- name: errorCode,
1991
- $metadata: deserializeMetadata(output),
1992
- };
1993
- break;
1777
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
1994
1778
  case "NotFoundException":
1995
1779
  case "com.amazonaws.amplifybackend#NotFoundException":
1996
- response = {
1997
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1998
- name: errorCode,
1999
- $metadata: deserializeMetadata(output),
2000
- };
2001
- break;
1780
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2002
1781
  case "TooManyRequestsException":
2003
1782
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2004
- response = {
2005
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2006
- name: errorCode,
2007
- $metadata: deserializeMetadata(output),
2008
- };
2009
- break;
1783
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2010
1784
  default:
2011
1785
  const parsedBody = parsedOutput.body;
2012
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2013
- response = {
2014
- ...parsedBody,
2015
- name: `${errorCode}`,
2016
- message: parsedBody.message || parsedBody.Message || errorCode,
1786
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1787
+ name: parsedBody.code || parsedBody.Code || errorCode,
2017
1788
  $fault: "client",
2018
1789
  $metadata: deserializeMetadata(output),
2019
- };
1790
+ });
1791
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2020
1792
  }
2021
- const message = response.message || response.Message || errorCode;
2022
- response.message = message;
2023
- delete response.Message;
2024
- return Promise.reject(Object.assign(new Error(message), response));
2025
1793
  };
2026
1794
  const deserializeAws_restJson1DeleteBackendAuthCommand = async (output, context) => {
2027
1795
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2069,51 +1837,25 @@ const deserializeAws_restJson1DeleteBackendAuthCommandError = async (output, con
2069
1837
  switch (errorCode) {
2070
1838
  case "BadRequestException":
2071
1839
  case "com.amazonaws.amplifybackend#BadRequestException":
2072
- response = {
2073
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2074
- name: errorCode,
2075
- $metadata: deserializeMetadata(output),
2076
- };
2077
- break;
1840
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2078
1841
  case "GatewayTimeoutException":
2079
1842
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2080
- response = {
2081
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2082
- name: errorCode,
2083
- $metadata: deserializeMetadata(output),
2084
- };
2085
- break;
1843
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2086
1844
  case "NotFoundException":
2087
1845
  case "com.amazonaws.amplifybackend#NotFoundException":
2088
- response = {
2089
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2090
- name: errorCode,
2091
- $metadata: deserializeMetadata(output),
2092
- };
2093
- break;
1846
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2094
1847
  case "TooManyRequestsException":
2095
1848
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2096
- response = {
2097
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2098
- name: errorCode,
2099
- $metadata: deserializeMetadata(output),
2100
- };
2101
- break;
1849
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2102
1850
  default:
2103
1851
  const parsedBody = parsedOutput.body;
2104
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2105
- response = {
2106
- ...parsedBody,
2107
- name: `${errorCode}`,
2108
- message: parsedBody.message || parsedBody.Message || errorCode,
1852
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1853
+ name: parsedBody.code || parsedBody.Code || errorCode,
2109
1854
  $fault: "client",
2110
1855
  $metadata: deserializeMetadata(output),
2111
- };
1856
+ });
1857
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2112
1858
  }
2113
- const message = response.message || response.Message || errorCode;
2114
- response.message = message;
2115
- delete response.Message;
2116
- return Promise.reject(Object.assign(new Error(message), response));
2117
1859
  };
2118
1860
  const deserializeAws_restJson1DeleteBackendStorageCommand = async (output, context) => {
2119
1861
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2153,51 +1895,25 @@ const deserializeAws_restJson1DeleteBackendStorageCommandError = async (output,
2153
1895
  switch (errorCode) {
2154
1896
  case "BadRequestException":
2155
1897
  case "com.amazonaws.amplifybackend#BadRequestException":
2156
- response = {
2157
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2158
- name: errorCode,
2159
- $metadata: deserializeMetadata(output),
2160
- };
2161
- break;
1898
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2162
1899
  case "GatewayTimeoutException":
2163
1900
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2164
- response = {
2165
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2166
- name: errorCode,
2167
- $metadata: deserializeMetadata(output),
2168
- };
2169
- break;
1901
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2170
1902
  case "NotFoundException":
2171
1903
  case "com.amazonaws.amplifybackend#NotFoundException":
2172
- response = {
2173
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2174
- name: errorCode,
2175
- $metadata: deserializeMetadata(output),
2176
- };
2177
- break;
1904
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2178
1905
  case "TooManyRequestsException":
2179
1906
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2180
- response = {
2181
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2182
- name: errorCode,
2183
- $metadata: deserializeMetadata(output),
2184
- };
2185
- break;
1907
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2186
1908
  default:
2187
1909
  const parsedBody = parsedOutput.body;
2188
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2189
- response = {
2190
- ...parsedBody,
2191
- name: `${errorCode}`,
2192
- message: parsedBody.message || parsedBody.Message || errorCode,
1910
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1911
+ name: parsedBody.code || parsedBody.Code || errorCode,
2193
1912
  $fault: "client",
2194
1913
  $metadata: deserializeMetadata(output),
2195
- };
1914
+ });
1915
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2196
1916
  }
2197
- const message = response.message || response.Message || errorCode;
2198
- response.message = message;
2199
- delete response.Message;
2200
- return Promise.reject(Object.assign(new Error(message), response));
2201
1917
  };
2202
1918
  const deserializeAws_restJson1DeleteTokenCommand = async (output, context) => {
2203
1919
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2225,51 +1941,25 @@ const deserializeAws_restJson1DeleteTokenCommandError = async (output, context)
2225
1941
  switch (errorCode) {
2226
1942
  case "BadRequestException":
2227
1943
  case "com.amazonaws.amplifybackend#BadRequestException":
2228
- response = {
2229
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2230
- name: errorCode,
2231
- $metadata: deserializeMetadata(output),
2232
- };
2233
- break;
1944
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2234
1945
  case "GatewayTimeoutException":
2235
1946
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2236
- response = {
2237
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2238
- name: errorCode,
2239
- $metadata: deserializeMetadata(output),
2240
- };
2241
- break;
1947
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2242
1948
  case "NotFoundException":
2243
1949
  case "com.amazonaws.amplifybackend#NotFoundException":
2244
- response = {
2245
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2246
- name: errorCode,
2247
- $metadata: deserializeMetadata(output),
2248
- };
2249
- break;
1950
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2250
1951
  case "TooManyRequestsException":
2251
1952
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2252
- response = {
2253
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2254
- name: errorCode,
2255
- $metadata: deserializeMetadata(output),
2256
- };
2257
- break;
1953
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2258
1954
  default:
2259
1955
  const parsedBody = parsedOutput.body;
2260
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2261
- response = {
2262
- ...parsedBody,
2263
- name: `${errorCode}`,
2264
- message: parsedBody.message || parsedBody.Message || errorCode,
1956
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
1957
+ name: parsedBody.code || parsedBody.Code || errorCode,
2265
1958
  $fault: "client",
2266
1959
  $metadata: deserializeMetadata(output),
2267
- };
1960
+ });
1961
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2268
1962
  }
2269
- const message = response.message || response.Message || errorCode;
2270
- response.message = message;
2271
- delete response.Message;
2272
- return Promise.reject(Object.assign(new Error(message), response));
2273
1963
  };
2274
1964
  const deserializeAws_restJson1GenerateBackendAPIModelsCommand = async (output, context) => {
2275
1965
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2317,51 +2007,25 @@ const deserializeAws_restJson1GenerateBackendAPIModelsCommandError = async (outp
2317
2007
  switch (errorCode) {
2318
2008
  case "BadRequestException":
2319
2009
  case "com.amazonaws.amplifybackend#BadRequestException":
2320
- response = {
2321
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2322
- name: errorCode,
2323
- $metadata: deserializeMetadata(output),
2324
- };
2325
- break;
2010
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2326
2011
  case "GatewayTimeoutException":
2327
2012
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2328
- response = {
2329
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2330
- name: errorCode,
2331
- $metadata: deserializeMetadata(output),
2332
- };
2333
- break;
2013
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2334
2014
  case "NotFoundException":
2335
2015
  case "com.amazonaws.amplifybackend#NotFoundException":
2336
- response = {
2337
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2338
- name: errorCode,
2339
- $metadata: deserializeMetadata(output),
2340
- };
2341
- break;
2016
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2342
2017
  case "TooManyRequestsException":
2343
2018
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2344
- response = {
2345
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2346
- name: errorCode,
2347
- $metadata: deserializeMetadata(output),
2348
- };
2349
- break;
2019
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2350
2020
  default:
2351
2021
  const parsedBody = parsedOutput.body;
2352
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2353
- response = {
2354
- ...parsedBody,
2355
- name: `${errorCode}`,
2356
- message: parsedBody.message || parsedBody.Message || errorCode,
2022
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2023
+ name: parsedBody.code || parsedBody.Code || errorCode,
2357
2024
  $fault: "client",
2358
2025
  $metadata: deserializeMetadata(output),
2359
- };
2026
+ });
2027
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2360
2028
  }
2361
- const message = response.message || response.Message || errorCode;
2362
- response.message = message;
2363
- delete response.Message;
2364
- return Promise.reject(Object.assign(new Error(message), response));
2365
2029
  };
2366
2030
  const deserializeAws_restJson1GetBackendCommand = async (output, context) => {
2367
2031
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2413,51 +2077,25 @@ const deserializeAws_restJson1GetBackendCommandError = async (output, context) =
2413
2077
  switch (errorCode) {
2414
2078
  case "BadRequestException":
2415
2079
  case "com.amazonaws.amplifybackend#BadRequestException":
2416
- response = {
2417
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2418
- name: errorCode,
2419
- $metadata: deserializeMetadata(output),
2420
- };
2421
- break;
2080
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2422
2081
  case "GatewayTimeoutException":
2423
2082
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2424
- response = {
2425
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2426
- name: errorCode,
2427
- $metadata: deserializeMetadata(output),
2428
- };
2429
- break;
2083
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2430
2084
  case "NotFoundException":
2431
2085
  case "com.amazonaws.amplifybackend#NotFoundException":
2432
- response = {
2433
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2434
- name: errorCode,
2435
- $metadata: deserializeMetadata(output),
2436
- };
2437
- break;
2086
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2438
2087
  case "TooManyRequestsException":
2439
2088
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2440
- response = {
2441
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2442
- name: errorCode,
2443
- $metadata: deserializeMetadata(output),
2444
- };
2445
- break;
2089
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2446
2090
  default:
2447
2091
  const parsedBody = parsedOutput.body;
2448
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2449
- response = {
2450
- ...parsedBody,
2451
- name: `${errorCode}`,
2452
- message: parsedBody.message || parsedBody.Message || errorCode,
2092
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2093
+ name: parsedBody.code || parsedBody.Code || errorCode,
2453
2094
  $fault: "client",
2454
2095
  $metadata: deserializeMetadata(output),
2455
- };
2096
+ });
2097
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2456
2098
  }
2457
- const message = response.message || response.Message || errorCode;
2458
- response.message = message;
2459
- delete response.Message;
2460
- return Promise.reject(Object.assign(new Error(message), response));
2461
2099
  };
2462
2100
  const deserializeAws_restJson1GetBackendAPICommand = async (output, context) => {
2463
2101
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2501,51 +2139,25 @@ const deserializeAws_restJson1GetBackendAPICommandError = async (output, context
2501
2139
  switch (errorCode) {
2502
2140
  case "BadRequestException":
2503
2141
  case "com.amazonaws.amplifybackend#BadRequestException":
2504
- response = {
2505
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2506
- name: errorCode,
2507
- $metadata: deserializeMetadata(output),
2508
- };
2509
- break;
2142
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2510
2143
  case "GatewayTimeoutException":
2511
2144
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2512
- response = {
2513
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2514
- name: errorCode,
2515
- $metadata: deserializeMetadata(output),
2516
- };
2517
- break;
2145
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2518
2146
  case "NotFoundException":
2519
2147
  case "com.amazonaws.amplifybackend#NotFoundException":
2520
- response = {
2521
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2522
- name: errorCode,
2523
- $metadata: deserializeMetadata(output),
2524
- };
2525
- break;
2148
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2526
2149
  case "TooManyRequestsException":
2527
2150
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2528
- response = {
2529
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2530
- name: errorCode,
2531
- $metadata: deserializeMetadata(output),
2532
- };
2533
- break;
2151
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2534
2152
  default:
2535
2153
  const parsedBody = parsedOutput.body;
2536
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2537
- response = {
2538
- ...parsedBody,
2539
- name: `${errorCode}`,
2540
- message: parsedBody.message || parsedBody.Message || errorCode,
2154
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2155
+ name: parsedBody.code || parsedBody.Code || errorCode,
2541
2156
  $fault: "client",
2542
2157
  $metadata: deserializeMetadata(output),
2543
- };
2158
+ });
2159
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2544
2160
  }
2545
- const message = response.message || response.Message || errorCode;
2546
- response.message = message;
2547
- delete response.Message;
2548
- return Promise.reject(Object.assign(new Error(message), response));
2549
2161
  };
2550
2162
  const deserializeAws_restJson1GetBackendAPIModelsCommand = async (output, context) => {
2551
2163
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2577,51 +2189,25 @@ const deserializeAws_restJson1GetBackendAPIModelsCommandError = async (output, c
2577
2189
  switch (errorCode) {
2578
2190
  case "BadRequestException":
2579
2191
  case "com.amazonaws.amplifybackend#BadRequestException":
2580
- response = {
2581
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2582
- name: errorCode,
2583
- $metadata: deserializeMetadata(output),
2584
- };
2585
- break;
2192
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2586
2193
  case "GatewayTimeoutException":
2587
2194
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2588
- response = {
2589
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2590
- name: errorCode,
2591
- $metadata: deserializeMetadata(output),
2592
- };
2593
- break;
2195
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2594
2196
  case "NotFoundException":
2595
2197
  case "com.amazonaws.amplifybackend#NotFoundException":
2596
- response = {
2597
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2598
- name: errorCode,
2599
- $metadata: deserializeMetadata(output),
2600
- };
2601
- break;
2198
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2602
2199
  case "TooManyRequestsException":
2603
2200
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2604
- response = {
2605
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2606
- name: errorCode,
2607
- $metadata: deserializeMetadata(output),
2608
- };
2609
- break;
2201
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2610
2202
  default:
2611
2203
  const parsedBody = parsedOutput.body;
2612
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2613
- response = {
2614
- ...parsedBody,
2615
- name: `${errorCode}`,
2616
- message: parsedBody.message || parsedBody.Message || errorCode,
2204
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2205
+ name: parsedBody.code || parsedBody.Code || errorCode,
2617
2206
  $fault: "client",
2618
2207
  $metadata: deserializeMetadata(output),
2619
- };
2208
+ });
2209
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2620
2210
  }
2621
- const message = response.message || response.Message || errorCode;
2622
- response.message = message;
2623
- delete response.Message;
2624
- return Promise.reject(Object.assign(new Error(message), response));
2625
2211
  };
2626
2212
  const deserializeAws_restJson1GetBackendAuthCommand = async (output, context) => {
2627
2213
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2665,51 +2251,25 @@ const deserializeAws_restJson1GetBackendAuthCommandError = async (output, contex
2665
2251
  switch (errorCode) {
2666
2252
  case "BadRequestException":
2667
2253
  case "com.amazonaws.amplifybackend#BadRequestException":
2668
- response = {
2669
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2670
- name: errorCode,
2671
- $metadata: deserializeMetadata(output),
2672
- };
2673
- break;
2254
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2674
2255
  case "GatewayTimeoutException":
2675
2256
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2676
- response = {
2677
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2678
- name: errorCode,
2679
- $metadata: deserializeMetadata(output),
2680
- };
2681
- break;
2257
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2682
2258
  case "NotFoundException":
2683
2259
  case "com.amazonaws.amplifybackend#NotFoundException":
2684
- response = {
2685
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2686
- name: errorCode,
2687
- $metadata: deserializeMetadata(output),
2688
- };
2689
- break;
2260
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2690
2261
  case "TooManyRequestsException":
2691
2262
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2692
- response = {
2693
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2694
- name: errorCode,
2695
- $metadata: deserializeMetadata(output),
2696
- };
2697
- break;
2263
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2698
2264
  default:
2699
2265
  const parsedBody = parsedOutput.body;
2700
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2701
- response = {
2702
- ...parsedBody,
2703
- name: `${errorCode}`,
2704
- message: parsedBody.message || parsedBody.Message || errorCode,
2266
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2267
+ name: parsedBody.code || parsedBody.Code || errorCode,
2705
2268
  $fault: "client",
2706
2269
  $metadata: deserializeMetadata(output),
2707
- };
2270
+ });
2271
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2708
2272
  }
2709
- const message = response.message || response.Message || errorCode;
2710
- response.message = message;
2711
- delete response.Message;
2712
- return Promise.reject(Object.assign(new Error(message), response));
2713
2273
  };
2714
2274
  const deserializeAws_restJson1GetBackendJobCommand = async (output, context) => {
2715
2275
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2765,51 +2325,25 @@ const deserializeAws_restJson1GetBackendJobCommandError = async (output, context
2765
2325
  switch (errorCode) {
2766
2326
  case "BadRequestException":
2767
2327
  case "com.amazonaws.amplifybackend#BadRequestException":
2768
- response = {
2769
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2770
- name: errorCode,
2771
- $metadata: deserializeMetadata(output),
2772
- };
2773
- break;
2328
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2774
2329
  case "GatewayTimeoutException":
2775
2330
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2776
- response = {
2777
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2778
- name: errorCode,
2779
- $metadata: deserializeMetadata(output),
2780
- };
2781
- break;
2331
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2782
2332
  case "NotFoundException":
2783
2333
  case "com.amazonaws.amplifybackend#NotFoundException":
2784
- response = {
2785
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2786
- name: errorCode,
2787
- $metadata: deserializeMetadata(output),
2788
- };
2789
- break;
2334
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2790
2335
  case "TooManyRequestsException":
2791
2336
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2792
- response = {
2793
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2794
- name: errorCode,
2795
- $metadata: deserializeMetadata(output),
2796
- };
2797
- break;
2337
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2798
2338
  default:
2799
2339
  const parsedBody = parsedOutput.body;
2800
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2801
- response = {
2802
- ...parsedBody,
2803
- name: `${errorCode}`,
2804
- message: parsedBody.message || parsedBody.Message || errorCode,
2340
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2341
+ name: parsedBody.code || parsedBody.Code || errorCode,
2805
2342
  $fault: "client",
2806
2343
  $metadata: deserializeMetadata(output),
2807
- };
2344
+ });
2345
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2808
2346
  }
2809
- const message = response.message || response.Message || errorCode;
2810
- response.message = message;
2811
- delete response.Message;
2812
- return Promise.reject(Object.assign(new Error(message), response));
2813
2347
  };
2814
2348
  const deserializeAws_restJson1GetBackendStorageCommand = async (output, context) => {
2815
2349
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2849,51 +2383,25 @@ const deserializeAws_restJson1GetBackendStorageCommandError = async (output, con
2849
2383
  switch (errorCode) {
2850
2384
  case "BadRequestException":
2851
2385
  case "com.amazonaws.amplifybackend#BadRequestException":
2852
- response = {
2853
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2854
- name: errorCode,
2855
- $metadata: deserializeMetadata(output),
2856
- };
2857
- break;
2386
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2858
2387
  case "GatewayTimeoutException":
2859
2388
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2860
- response = {
2861
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2862
- name: errorCode,
2863
- $metadata: deserializeMetadata(output),
2864
- };
2865
- break;
2389
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2866
2390
  case "NotFoundException":
2867
2391
  case "com.amazonaws.amplifybackend#NotFoundException":
2868
- response = {
2869
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2870
- name: errorCode,
2871
- $metadata: deserializeMetadata(output),
2872
- };
2873
- break;
2392
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2874
2393
  case "TooManyRequestsException":
2875
2394
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2876
- response = {
2877
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2878
- name: errorCode,
2879
- $metadata: deserializeMetadata(output),
2880
- };
2881
- break;
2395
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2882
2396
  default:
2883
2397
  const parsedBody = parsedOutput.body;
2884
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2885
- response = {
2886
- ...parsedBody,
2887
- name: `${errorCode}`,
2888
- message: parsedBody.message || parsedBody.Message || errorCode,
2398
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2399
+ name: parsedBody.code || parsedBody.Code || errorCode,
2889
2400
  $fault: "client",
2890
2401
  $metadata: deserializeMetadata(output),
2891
- };
2402
+ });
2403
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2892
2404
  }
2893
- const message = response.message || response.Message || errorCode;
2894
- response.message = message;
2895
- delete response.Message;
2896
- return Promise.reject(Object.assign(new Error(message), response));
2897
2405
  };
2898
2406
  const deserializeAws_restJson1GetTokenCommand = async (output, context) => {
2899
2407
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2933,51 +2441,25 @@ const deserializeAws_restJson1GetTokenCommandError = async (output, context) =>
2933
2441
  switch (errorCode) {
2934
2442
  case "BadRequestException":
2935
2443
  case "com.amazonaws.amplifybackend#BadRequestException":
2936
- response = {
2937
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2938
- name: errorCode,
2939
- $metadata: deserializeMetadata(output),
2940
- };
2941
- break;
2444
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2942
2445
  case "GatewayTimeoutException":
2943
2446
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
2944
- response = {
2945
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
2946
- name: errorCode,
2947
- $metadata: deserializeMetadata(output),
2948
- };
2949
- break;
2447
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
2950
2448
  case "NotFoundException":
2951
2449
  case "com.amazonaws.amplifybackend#NotFoundException":
2952
- response = {
2953
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2954
- name: errorCode,
2955
- $metadata: deserializeMetadata(output),
2956
- };
2957
- break;
2450
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2958
2451
  case "TooManyRequestsException":
2959
2452
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
2960
- response = {
2961
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
2962
- name: errorCode,
2963
- $metadata: deserializeMetadata(output),
2964
- };
2965
- break;
2453
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
2966
2454
  default:
2967
2455
  const parsedBody = parsedOutput.body;
2968
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2969
- response = {
2970
- ...parsedBody,
2971
- name: `${errorCode}`,
2972
- message: parsedBody.message || parsedBody.Message || errorCode,
2456
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2457
+ name: parsedBody.code || parsedBody.Code || errorCode,
2973
2458
  $fault: "client",
2974
2459
  $metadata: deserializeMetadata(output),
2975
- };
2460
+ });
2461
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2976
2462
  }
2977
- const message = response.message || response.Message || errorCode;
2978
- response.message = message;
2979
- delete response.Message;
2980
- return Promise.reject(Object.assign(new Error(message), response));
2981
2463
  };
2982
2464
  const deserializeAws_restJson1ImportBackendAuthCommand = async (output, context) => {
2983
2465
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3025,51 +2507,25 @@ const deserializeAws_restJson1ImportBackendAuthCommandError = async (output, con
3025
2507
  switch (errorCode) {
3026
2508
  case "BadRequestException":
3027
2509
  case "com.amazonaws.amplifybackend#BadRequestException":
3028
- response = {
3029
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3030
- name: errorCode,
3031
- $metadata: deserializeMetadata(output),
3032
- };
3033
- break;
2510
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3034
2511
  case "GatewayTimeoutException":
3035
2512
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3036
- response = {
3037
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3038
- name: errorCode,
3039
- $metadata: deserializeMetadata(output),
3040
- };
3041
- break;
2513
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3042
2514
  case "NotFoundException":
3043
2515
  case "com.amazonaws.amplifybackend#NotFoundException":
3044
- response = {
3045
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3046
- name: errorCode,
3047
- $metadata: deserializeMetadata(output),
3048
- };
3049
- break;
2516
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3050
2517
  case "TooManyRequestsException":
3051
2518
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3052
- response = {
3053
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3054
- name: errorCode,
3055
- $metadata: deserializeMetadata(output),
3056
- };
3057
- break;
2519
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3058
2520
  default:
3059
2521
  const parsedBody = parsedOutput.body;
3060
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3061
- response = {
3062
- ...parsedBody,
3063
- name: `${errorCode}`,
3064
- message: parsedBody.message || parsedBody.Message || errorCode,
2522
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2523
+ name: parsedBody.code || parsedBody.Code || errorCode,
3065
2524
  $fault: "client",
3066
2525
  $metadata: deserializeMetadata(output),
3067
- };
2526
+ });
2527
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3068
2528
  }
3069
- const message = response.message || response.Message || errorCode;
3070
- response.message = message;
3071
- delete response.Message;
3072
- return Promise.reject(Object.assign(new Error(message), response));
3073
2529
  };
3074
2530
  const deserializeAws_restJson1ImportBackendStorageCommand = async (output, context) => {
3075
2531
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3109,51 +2565,25 @@ const deserializeAws_restJson1ImportBackendStorageCommandError = async (output,
3109
2565
  switch (errorCode) {
3110
2566
  case "BadRequestException":
3111
2567
  case "com.amazonaws.amplifybackend#BadRequestException":
3112
- response = {
3113
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3114
- name: errorCode,
3115
- $metadata: deserializeMetadata(output),
3116
- };
3117
- break;
2568
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3118
2569
  case "GatewayTimeoutException":
3119
2570
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3120
- response = {
3121
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3122
- name: errorCode,
3123
- $metadata: deserializeMetadata(output),
3124
- };
3125
- break;
2571
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3126
2572
  case "NotFoundException":
3127
2573
  case "com.amazonaws.amplifybackend#NotFoundException":
3128
- response = {
3129
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3130
- name: errorCode,
3131
- $metadata: deserializeMetadata(output),
3132
- };
3133
- break;
2574
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3134
2575
  case "TooManyRequestsException":
3135
2576
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3136
- response = {
3137
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3138
- name: errorCode,
3139
- $metadata: deserializeMetadata(output),
3140
- };
3141
- break;
2577
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3142
2578
  default:
3143
2579
  const parsedBody = parsedOutput.body;
3144
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3145
- response = {
3146
- ...parsedBody,
3147
- name: `${errorCode}`,
3148
- message: parsedBody.message || parsedBody.Message || errorCode,
2580
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2581
+ name: parsedBody.code || parsedBody.Code || errorCode,
3149
2582
  $fault: "client",
3150
2583
  $metadata: deserializeMetadata(output),
3151
- };
2584
+ });
2585
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3152
2586
  }
3153
- const message = response.message || response.Message || errorCode;
3154
- response.message = message;
3155
- delete response.Message;
3156
- return Promise.reject(Object.assign(new Error(message), response));
3157
2587
  };
3158
2588
  const deserializeAws_restJson1ListBackendJobsCommand = async (output, context) => {
3159
2589
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3185,51 +2615,25 @@ const deserializeAws_restJson1ListBackendJobsCommandError = async (output, conte
3185
2615
  switch (errorCode) {
3186
2616
  case "BadRequestException":
3187
2617
  case "com.amazonaws.amplifybackend#BadRequestException":
3188
- response = {
3189
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3190
- name: errorCode,
3191
- $metadata: deserializeMetadata(output),
3192
- };
3193
- break;
2618
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3194
2619
  case "GatewayTimeoutException":
3195
2620
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3196
- response = {
3197
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3198
- name: errorCode,
3199
- $metadata: deserializeMetadata(output),
3200
- };
3201
- break;
2621
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3202
2622
  case "NotFoundException":
3203
2623
  case "com.amazonaws.amplifybackend#NotFoundException":
3204
- response = {
3205
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3206
- name: errorCode,
3207
- $metadata: deserializeMetadata(output),
3208
- };
3209
- break;
2624
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3210
2625
  case "TooManyRequestsException":
3211
2626
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3212
- response = {
3213
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3214
- name: errorCode,
3215
- $metadata: deserializeMetadata(output),
3216
- };
3217
- break;
2627
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3218
2628
  default:
3219
2629
  const parsedBody = parsedOutput.body;
3220
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3221
- response = {
3222
- ...parsedBody,
3223
- name: `${errorCode}`,
3224
- message: parsedBody.message || parsedBody.Message || errorCode,
2630
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2631
+ name: parsedBody.code || parsedBody.Code || errorCode,
3225
2632
  $fault: "client",
3226
2633
  $metadata: deserializeMetadata(output),
3227
- };
2634
+ });
2635
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3228
2636
  }
3229
- const message = response.message || response.Message || errorCode;
3230
- response.message = message;
3231
- delete response.Message;
3232
- return Promise.reject(Object.assign(new Error(message), response));
3233
2637
  };
3234
2638
  const deserializeAws_restJson1ListS3BucketsCommand = async (output, context) => {
3235
2639
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3261,51 +2665,25 @@ const deserializeAws_restJson1ListS3BucketsCommandError = async (output, context
3261
2665
  switch (errorCode) {
3262
2666
  case "BadRequestException":
3263
2667
  case "com.amazonaws.amplifybackend#BadRequestException":
3264
- response = {
3265
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3266
- name: errorCode,
3267
- $metadata: deserializeMetadata(output),
3268
- };
3269
- break;
2668
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3270
2669
  case "GatewayTimeoutException":
3271
2670
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3272
- response = {
3273
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3274
- name: errorCode,
3275
- $metadata: deserializeMetadata(output),
3276
- };
3277
- break;
2671
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3278
2672
  case "NotFoundException":
3279
2673
  case "com.amazonaws.amplifybackend#NotFoundException":
3280
- response = {
3281
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3282
- name: errorCode,
3283
- $metadata: deserializeMetadata(output),
3284
- };
3285
- break;
2674
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3286
2675
  case "TooManyRequestsException":
3287
2676
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3288
- response = {
3289
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3290
- name: errorCode,
3291
- $metadata: deserializeMetadata(output),
3292
- };
3293
- break;
2677
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3294
2678
  default:
3295
2679
  const parsedBody = parsedOutput.body;
3296
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3297
- response = {
3298
- ...parsedBody,
3299
- name: `${errorCode}`,
3300
- message: parsedBody.message || parsedBody.Message || errorCode,
2680
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2681
+ name: parsedBody.code || parsedBody.Code || errorCode,
3301
2682
  $fault: "client",
3302
2683
  $metadata: deserializeMetadata(output),
3303
- };
2684
+ });
2685
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3304
2686
  }
3305
- const message = response.message || response.Message || errorCode;
3306
- response.message = message;
3307
- delete response.Message;
3308
- return Promise.reject(Object.assign(new Error(message), response));
3309
2687
  };
3310
2688
  const deserializeAws_restJson1RemoveAllBackendsCommand = async (output, context) => {
3311
2689
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3349,51 +2727,25 @@ const deserializeAws_restJson1RemoveAllBackendsCommandError = async (output, con
3349
2727
  switch (errorCode) {
3350
2728
  case "BadRequestException":
3351
2729
  case "com.amazonaws.amplifybackend#BadRequestException":
3352
- response = {
3353
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3354
- name: errorCode,
3355
- $metadata: deserializeMetadata(output),
3356
- };
3357
- break;
2730
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3358
2731
  case "GatewayTimeoutException":
3359
2732
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3360
- response = {
3361
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3362
- name: errorCode,
3363
- $metadata: deserializeMetadata(output),
3364
- };
3365
- break;
2733
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3366
2734
  case "NotFoundException":
3367
2735
  case "com.amazonaws.amplifybackend#NotFoundException":
3368
- response = {
3369
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3370
- name: errorCode,
3371
- $metadata: deserializeMetadata(output),
3372
- };
3373
- break;
2736
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3374
2737
  case "TooManyRequestsException":
3375
2738
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3376
- response = {
3377
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3378
- name: errorCode,
3379
- $metadata: deserializeMetadata(output),
3380
- };
3381
- break;
2739
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3382
2740
  default:
3383
2741
  const parsedBody = parsedOutput.body;
3384
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3385
- response = {
3386
- ...parsedBody,
3387
- name: `${errorCode}`,
3388
- message: parsedBody.message || parsedBody.Message || errorCode,
2742
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2743
+ name: parsedBody.code || parsedBody.Code || errorCode,
3389
2744
  $fault: "client",
3390
2745
  $metadata: deserializeMetadata(output),
3391
- };
2746
+ });
2747
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3392
2748
  }
3393
- const message = response.message || response.Message || errorCode;
3394
- response.message = message;
3395
- delete response.Message;
3396
- return Promise.reject(Object.assign(new Error(message), response));
3397
2749
  };
3398
2750
  const deserializeAws_restJson1RemoveBackendConfigCommand = async (output, context) => {
3399
2751
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3421,51 +2773,25 @@ const deserializeAws_restJson1RemoveBackendConfigCommandError = async (output, c
3421
2773
  switch (errorCode) {
3422
2774
  case "BadRequestException":
3423
2775
  case "com.amazonaws.amplifybackend#BadRequestException":
3424
- response = {
3425
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3426
- name: errorCode,
3427
- $metadata: deserializeMetadata(output),
3428
- };
3429
- break;
2776
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3430
2777
  case "GatewayTimeoutException":
3431
2778
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3432
- response = {
3433
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3434
- name: errorCode,
3435
- $metadata: deserializeMetadata(output),
3436
- };
3437
- break;
2779
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3438
2780
  case "NotFoundException":
3439
2781
  case "com.amazonaws.amplifybackend#NotFoundException":
3440
- response = {
3441
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3442
- name: errorCode,
3443
- $metadata: deserializeMetadata(output),
3444
- };
3445
- break;
2782
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3446
2783
  case "TooManyRequestsException":
3447
2784
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3448
- response = {
3449
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3450
- name: errorCode,
3451
- $metadata: deserializeMetadata(output),
3452
- };
3453
- break;
2785
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3454
2786
  default:
3455
2787
  const parsedBody = parsedOutput.body;
3456
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3457
- response = {
3458
- ...parsedBody,
3459
- name: `${errorCode}`,
3460
- message: parsedBody.message || parsedBody.Message || errorCode,
2788
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2789
+ name: parsedBody.code || parsedBody.Code || errorCode,
3461
2790
  $fault: "client",
3462
2791
  $metadata: deserializeMetadata(output),
3463
- };
2792
+ });
2793
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3464
2794
  }
3465
- const message = response.message || response.Message || errorCode;
3466
- response.message = message;
3467
- delete response.Message;
3468
- return Promise.reject(Object.assign(new Error(message), response));
3469
2795
  };
3470
2796
  const deserializeAws_restJson1UpdateBackendAPICommand = async (output, context) => {
3471
2797
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3513,51 +2839,25 @@ const deserializeAws_restJson1UpdateBackendAPICommandError = async (output, cont
3513
2839
  switch (errorCode) {
3514
2840
  case "BadRequestException":
3515
2841
  case "com.amazonaws.amplifybackend#BadRequestException":
3516
- response = {
3517
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3518
- name: errorCode,
3519
- $metadata: deserializeMetadata(output),
3520
- };
3521
- break;
2842
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3522
2843
  case "GatewayTimeoutException":
3523
2844
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3524
- response = {
3525
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3526
- name: errorCode,
3527
- $metadata: deserializeMetadata(output),
3528
- };
3529
- break;
2845
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3530
2846
  case "NotFoundException":
3531
2847
  case "com.amazonaws.amplifybackend#NotFoundException":
3532
- response = {
3533
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3534
- name: errorCode,
3535
- $metadata: deserializeMetadata(output),
3536
- };
3537
- break;
2848
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3538
2849
  case "TooManyRequestsException":
3539
2850
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3540
- response = {
3541
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3542
- name: errorCode,
3543
- $metadata: deserializeMetadata(output),
3544
- };
3545
- break;
2851
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3546
2852
  default:
3547
2853
  const parsedBody = parsedOutput.body;
3548
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3549
- response = {
3550
- ...parsedBody,
3551
- name: `${errorCode}`,
3552
- message: parsedBody.message || parsedBody.Message || errorCode,
2854
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2855
+ name: parsedBody.code || parsedBody.Code || errorCode,
3553
2856
  $fault: "client",
3554
2857
  $metadata: deserializeMetadata(output),
3555
- };
2858
+ });
2859
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3556
2860
  }
3557
- const message = response.message || response.Message || errorCode;
3558
- response.message = message;
3559
- delete response.Message;
3560
- return Promise.reject(Object.assign(new Error(message), response));
3561
2861
  };
3562
2862
  const deserializeAws_restJson1UpdateBackendAuthCommand = async (output, context) => {
3563
2863
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3605,51 +2905,25 @@ const deserializeAws_restJson1UpdateBackendAuthCommandError = async (output, con
3605
2905
  switch (errorCode) {
3606
2906
  case "BadRequestException":
3607
2907
  case "com.amazonaws.amplifybackend#BadRequestException":
3608
- response = {
3609
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3610
- name: errorCode,
3611
- $metadata: deserializeMetadata(output),
3612
- };
3613
- break;
2908
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3614
2909
  case "GatewayTimeoutException":
3615
2910
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3616
- response = {
3617
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3618
- name: errorCode,
3619
- $metadata: deserializeMetadata(output),
3620
- };
3621
- break;
2911
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3622
2912
  case "NotFoundException":
3623
2913
  case "com.amazonaws.amplifybackend#NotFoundException":
3624
- response = {
3625
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3626
- name: errorCode,
3627
- $metadata: deserializeMetadata(output),
3628
- };
3629
- break;
2914
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3630
2915
  case "TooManyRequestsException":
3631
2916
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3632
- response = {
3633
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3634
- name: errorCode,
3635
- $metadata: deserializeMetadata(output),
3636
- };
3637
- break;
2917
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3638
2918
  default:
3639
2919
  const parsedBody = parsedOutput.body;
3640
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3641
- response = {
3642
- ...parsedBody,
3643
- name: `${errorCode}`,
3644
- message: parsedBody.message || parsedBody.Message || errorCode,
2920
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2921
+ name: parsedBody.code || parsedBody.Code || errorCode,
3645
2922
  $fault: "client",
3646
2923
  $metadata: deserializeMetadata(output),
3647
- };
2924
+ });
2925
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3648
2926
  }
3649
- const message = response.message || response.Message || errorCode;
3650
- response.message = message;
3651
- delete response.Message;
3652
- return Promise.reject(Object.assign(new Error(message), response));
3653
2927
  };
3654
2928
  const deserializeAws_restJson1UpdateBackendConfigCommand = async (output, context) => {
3655
2929
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3689,51 +2963,25 @@ const deserializeAws_restJson1UpdateBackendConfigCommandError = async (output, c
3689
2963
  switch (errorCode) {
3690
2964
  case "BadRequestException":
3691
2965
  case "com.amazonaws.amplifybackend#BadRequestException":
3692
- response = {
3693
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3694
- name: errorCode,
3695
- $metadata: deserializeMetadata(output),
3696
- };
3697
- break;
2966
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3698
2967
  case "GatewayTimeoutException":
3699
2968
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3700
- response = {
3701
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3702
- name: errorCode,
3703
- $metadata: deserializeMetadata(output),
3704
- };
3705
- break;
2969
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3706
2970
  case "NotFoundException":
3707
2971
  case "com.amazonaws.amplifybackend#NotFoundException":
3708
- response = {
3709
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3710
- name: errorCode,
3711
- $metadata: deserializeMetadata(output),
3712
- };
3713
- break;
2972
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3714
2973
  case "TooManyRequestsException":
3715
2974
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3716
- response = {
3717
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3718
- name: errorCode,
3719
- $metadata: deserializeMetadata(output),
3720
- };
3721
- break;
2975
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3722
2976
  default:
3723
2977
  const parsedBody = parsedOutput.body;
3724
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3725
- response = {
3726
- ...parsedBody,
3727
- name: `${errorCode}`,
3728
- message: parsedBody.message || parsedBody.Message || errorCode,
2978
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
2979
+ name: parsedBody.code || parsedBody.Code || errorCode,
3729
2980
  $fault: "client",
3730
2981
  $metadata: deserializeMetadata(output),
3731
- };
2982
+ });
2983
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3732
2984
  }
3733
- const message = response.message || response.Message || errorCode;
3734
- response.message = message;
3735
- delete response.Message;
3736
- return Promise.reject(Object.assign(new Error(message), response));
3737
2985
  };
3738
2986
  const deserializeAws_restJson1UpdateBackendJobCommand = async (output, context) => {
3739
2987
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3789,51 +3037,25 @@ const deserializeAws_restJson1UpdateBackendJobCommandError = async (output, cont
3789
3037
  switch (errorCode) {
3790
3038
  case "BadRequestException":
3791
3039
  case "com.amazonaws.amplifybackend#BadRequestException":
3792
- response = {
3793
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3794
- name: errorCode,
3795
- $metadata: deserializeMetadata(output),
3796
- };
3797
- break;
3040
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3798
3041
  case "GatewayTimeoutException":
3799
3042
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3800
- response = {
3801
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3802
- name: errorCode,
3803
- $metadata: deserializeMetadata(output),
3804
- };
3805
- break;
3043
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3806
3044
  case "NotFoundException":
3807
3045
  case "com.amazonaws.amplifybackend#NotFoundException":
3808
- response = {
3809
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3810
- name: errorCode,
3811
- $metadata: deserializeMetadata(output),
3812
- };
3813
- break;
3046
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3814
3047
  case "TooManyRequestsException":
3815
3048
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3816
- response = {
3817
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3818
- name: errorCode,
3819
- $metadata: deserializeMetadata(output),
3820
- };
3821
- break;
3049
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3822
3050
  default:
3823
3051
  const parsedBody = parsedOutput.body;
3824
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3825
- response = {
3826
- ...parsedBody,
3827
- name: `${errorCode}`,
3828
- message: parsedBody.message || parsedBody.Message || errorCode,
3052
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
3053
+ name: parsedBody.code || parsedBody.Code || errorCode,
3829
3054
  $fault: "client",
3830
3055
  $metadata: deserializeMetadata(output),
3831
- };
3056
+ });
3057
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3832
3058
  }
3833
- const message = response.message || response.Message || errorCode;
3834
- response.message = message;
3835
- delete response.Message;
3836
- return Promise.reject(Object.assign(new Error(message), response));
3837
3059
  };
3838
3060
  const deserializeAws_restJson1UpdateBackendStorageCommand = async (output, context) => {
3839
3061
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3873,86 +3095,52 @@ const deserializeAws_restJson1UpdateBackendStorageCommandError = async (output,
3873
3095
  switch (errorCode) {
3874
3096
  case "BadRequestException":
3875
3097
  case "com.amazonaws.amplifybackend#BadRequestException":
3876
- response = {
3877
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3878
- name: errorCode,
3879
- $metadata: deserializeMetadata(output),
3880
- };
3881
- break;
3098
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3882
3099
  case "GatewayTimeoutException":
3883
3100
  case "com.amazonaws.amplifybackend#GatewayTimeoutException":
3884
- response = {
3885
- ...(await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context)),
3886
- name: errorCode,
3887
- $metadata: deserializeMetadata(output),
3888
- };
3889
- break;
3101
+ throw await deserializeAws_restJson1GatewayTimeoutExceptionResponse(parsedOutput, context);
3890
3102
  case "NotFoundException":
3891
3103
  case "com.amazonaws.amplifybackend#NotFoundException":
3892
- response = {
3893
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3894
- name: errorCode,
3895
- $metadata: deserializeMetadata(output),
3896
- };
3897
- break;
3104
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3898
3105
  case "TooManyRequestsException":
3899
3106
  case "com.amazonaws.amplifybackend#TooManyRequestsException":
3900
- response = {
3901
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
3902
- name: errorCode,
3903
- $metadata: deserializeMetadata(output),
3904
- };
3905
- break;
3107
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
3906
3108
  default:
3907
3109
  const parsedBody = parsedOutput.body;
3908
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3909
- response = {
3910
- ...parsedBody,
3911
- name: `${errorCode}`,
3912
- message: parsedBody.message || parsedBody.Message || errorCode,
3110
+ response = new AmplifyBackendServiceException_1.AmplifyBackendServiceException({
3111
+ name: parsedBody.code || parsedBody.Code || errorCode,
3913
3112
  $fault: "client",
3914
3113
  $metadata: deserializeMetadata(output),
3915
- };
3114
+ });
3115
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3916
3116
  }
3917
- const message = response.message || response.Message || errorCode;
3918
- response.message = message;
3919
- delete response.Message;
3920
- return Promise.reject(Object.assign(new Error(message), response));
3921
3117
  };
3922
3118
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
3923
- const contents = {
3924
- name: "BadRequestException",
3925
- $fault: "client",
3926
- $metadata: deserializeMetadata(parsedOutput),
3927
- Message: undefined,
3928
- };
3119
+ const contents = {};
3929
3120
  const data = parsedOutput.body;
3930
3121
  if (data.message !== undefined && data.message !== null) {
3931
3122
  contents.Message = smithy_client_1.expectString(data.message);
3932
3123
  }
3933
- return contents;
3124
+ const exception = new models_0_1.BadRequestException({
3125
+ $metadata: deserializeMetadata(parsedOutput),
3126
+ ...contents,
3127
+ });
3128
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3934
3129
  };
3935
3130
  const deserializeAws_restJson1GatewayTimeoutExceptionResponse = async (parsedOutput, context) => {
3936
- const contents = {
3937
- name: "GatewayTimeoutException",
3938
- $fault: "server",
3939
- $metadata: deserializeMetadata(parsedOutput),
3940
- Message: undefined,
3941
- };
3131
+ const contents = {};
3942
3132
  const data = parsedOutput.body;
3943
3133
  if (data.message !== undefined && data.message !== null) {
3944
3134
  contents.Message = smithy_client_1.expectString(data.message);
3945
3135
  }
3946
- return contents;
3136
+ const exception = new models_0_1.GatewayTimeoutException({
3137
+ $metadata: deserializeMetadata(parsedOutput),
3138
+ ...contents,
3139
+ });
3140
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3947
3141
  };
3948
3142
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
3949
- const contents = {
3950
- name: "NotFoundException",
3951
- $fault: "client",
3952
- $metadata: deserializeMetadata(parsedOutput),
3953
- Message: undefined,
3954
- ResourceType: undefined,
3955
- };
3143
+ const contents = {};
3956
3144
  const data = parsedOutput.body;
3957
3145
  if (data.message !== undefined && data.message !== null) {
3958
3146
  contents.Message = smithy_client_1.expectString(data.message);
@@ -3960,16 +3148,14 @@ const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, c
3960
3148
  if (data.resourceType !== undefined && data.resourceType !== null) {
3961
3149
  contents.ResourceType = smithy_client_1.expectString(data.resourceType);
3962
3150
  }
3963
- return contents;
3151
+ const exception = new models_0_1.NotFoundException({
3152
+ $metadata: deserializeMetadata(parsedOutput),
3153
+ ...contents,
3154
+ });
3155
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3964
3156
  };
3965
3157
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
3966
- const contents = {
3967
- name: "TooManyRequestsException",
3968
- $fault: "client",
3969
- $metadata: deserializeMetadata(parsedOutput),
3970
- LimitType: undefined,
3971
- Message: undefined,
3972
- };
3158
+ const contents = {};
3973
3159
  const data = parsedOutput.body;
3974
3160
  if (data.limitType !== undefined && data.limitType !== null) {
3975
3161
  contents.LimitType = smithy_client_1.expectString(data.limitType);
@@ -3977,7 +3163,11 @@ const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOu
3977
3163
  if (data.message !== undefined && data.message !== null) {
3978
3164
  contents.Message = smithy_client_1.expectString(data.message);
3979
3165
  }
3980
- return contents;
3166
+ const exception = new models_0_1.TooManyRequestsException({
3167
+ $metadata: deserializeMetadata(parsedOutput),
3168
+ ...contents,
3169
+ });
3170
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3981
3171
  };
3982
3172
  const serializeAws_restJson1BackendAPIAppSyncAuthSettings = (input, context) => {
3983
3173
  return {
@@ -4571,7 +3761,7 @@ const deserializeAws_restJson1GetBackendStorageResourceConfig = (output, context
4571
3761
  };
4572
3762
  };
4573
3763
  const deserializeAws_restJson1ListOf__string = (output, context) => {
4574
- return (output || [])
3764
+ const retVal = (output || [])
4575
3765
  .filter((e) => e != null)
4576
3766
  .map((entry) => {
4577
3767
  if (entry === null) {
@@ -4579,9 +3769,10 @@ const deserializeAws_restJson1ListOf__string = (output, context) => {
4579
3769
  }
4580
3770
  return smithy_client_1.expectString(entry);
4581
3771
  });
3772
+ return retVal;
4582
3773
  };
4583
3774
  const deserializeAws_restJson1ListOfAdditionalConstraintsElement = (output, context) => {
4584
- return (output || [])
3775
+ const retVal = (output || [])
4585
3776
  .filter((e) => e != null)
4586
3777
  .map((entry) => {
4587
3778
  if (entry === null) {
@@ -4589,9 +3780,10 @@ const deserializeAws_restJson1ListOfAdditionalConstraintsElement = (output, cont
4589
3780
  }
4590
3781
  return smithy_client_1.expectString(entry);
4591
3782
  });
3783
+ return retVal;
4592
3784
  };
4593
3785
  const deserializeAws_restJson1ListOfAuthenticatedElement = (output, context) => {
4594
- return (output || [])
3786
+ const retVal = (output || [])
4595
3787
  .filter((e) => e != null)
4596
3788
  .map((entry) => {
4597
3789
  if (entry === null) {
@@ -4599,9 +3791,10 @@ const deserializeAws_restJson1ListOfAuthenticatedElement = (output, context) =>
4599
3791
  }
4600
3792
  return smithy_client_1.expectString(entry);
4601
3793
  });
3794
+ return retVal;
4602
3795
  };
4603
3796
  const deserializeAws_restJson1ListOfBackendAPIAuthType = (output, context) => {
4604
- return (output || [])
3797
+ const retVal = (output || [])
4605
3798
  .filter((e) => e != null)
4606
3799
  .map((entry) => {
4607
3800
  if (entry === null) {
@@ -4609,9 +3802,10 @@ const deserializeAws_restJson1ListOfBackendAPIAuthType = (output, context) => {
4609
3802
  }
4610
3803
  return deserializeAws_restJson1BackendAPIAuthType(entry, context);
4611
3804
  });
3805
+ return retVal;
4612
3806
  };
4613
3807
  const deserializeAws_restJson1ListOfBackendJobRespObj = (output, context) => {
4614
- return (output || [])
3808
+ const retVal = (output || [])
4615
3809
  .filter((e) => e != null)
4616
3810
  .map((entry) => {
4617
3811
  if (entry === null) {
@@ -4619,9 +3813,10 @@ const deserializeAws_restJson1ListOfBackendJobRespObj = (output, context) => {
4619
3813
  }
4620
3814
  return deserializeAws_restJson1BackendJobRespObj(entry, context);
4621
3815
  });
3816
+ return retVal;
4622
3817
  };
4623
3818
  const deserializeAws_restJson1ListOfMfaTypesElement = (output, context) => {
4624
- return (output || [])
3819
+ const retVal = (output || [])
4625
3820
  .filter((e) => e != null)
4626
3821
  .map((entry) => {
4627
3822
  if (entry === null) {
@@ -4629,9 +3824,10 @@ const deserializeAws_restJson1ListOfMfaTypesElement = (output, context) => {
4629
3824
  }
4630
3825
  return smithy_client_1.expectString(entry);
4631
3826
  });
3827
+ return retVal;
4632
3828
  };
4633
3829
  const deserializeAws_restJson1ListOfOAuthScopesElement = (output, context) => {
4634
- return (output || [])
3830
+ const retVal = (output || [])
4635
3831
  .filter((e) => e != null)
4636
3832
  .map((entry) => {
4637
3833
  if (entry === null) {
@@ -4639,9 +3835,10 @@ const deserializeAws_restJson1ListOfOAuthScopesElement = (output, context) => {
4639
3835
  }
4640
3836
  return smithy_client_1.expectString(entry);
4641
3837
  });
3838
+ return retVal;
4642
3839
  };
4643
3840
  const deserializeAws_restJson1ListOfRequiredSignUpAttributesElement = (output, context) => {
4644
- return (output || [])
3841
+ const retVal = (output || [])
4645
3842
  .filter((e) => e != null)
4646
3843
  .map((entry) => {
4647
3844
  if (entry === null) {
@@ -4649,9 +3846,10 @@ const deserializeAws_restJson1ListOfRequiredSignUpAttributesElement = (output, c
4649
3846
  }
4650
3847
  return smithy_client_1.expectString(entry);
4651
3848
  });
3849
+ return retVal;
4652
3850
  };
4653
3851
  const deserializeAws_restJson1ListOfS3BucketInfo = (output, context) => {
4654
- return (output || [])
3852
+ const retVal = (output || [])
4655
3853
  .filter((e) => e != null)
4656
3854
  .map((entry) => {
4657
3855
  if (entry === null) {
@@ -4659,9 +3857,10 @@ const deserializeAws_restJson1ListOfS3BucketInfo = (output, context) => {
4659
3857
  }
4660
3858
  return deserializeAws_restJson1S3BucketInfo(entry, context);
4661
3859
  });
3860
+ return retVal;
4662
3861
  };
4663
3862
  const deserializeAws_restJson1ListOfUnAuthenticatedElement = (output, context) => {
4664
- return (output || [])
3863
+ const retVal = (output || [])
4665
3864
  .filter((e) => e != null)
4666
3865
  .map((entry) => {
4667
3866
  if (entry === null) {
@@ -4669,6 +3868,7 @@ const deserializeAws_restJson1ListOfUnAuthenticatedElement = (output, context) =
4669
3868
  }
4670
3869
  return smithy_client_1.expectString(entry);
4671
3870
  });
3871
+ return retVal;
4672
3872
  };
4673
3873
  const deserializeAws_restJson1LoginAuthConfigReqObj = (output, context) => {
4674
3874
  return {