@aws-sdk/client-amplify 3.50.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist-cjs/index.js +3 -0
  3. package/dist-cjs/models/AmplifyServiceException.js +11 -0
  4. package/dist-cjs/models/models_0.js +95 -2
  5. package/dist-cjs/protocols/Aws_restJson1.js +384 -1418
  6. package/dist-es/index.js +1 -0
  7. package/dist-es/models/AmplifyServiceException.js +12 -0
  8. package/dist-es/models/models_0.js +87 -1
  9. package/dist-es/protocols/Aws_restJson1.js +831 -1574
  10. package/dist-types/index.d.ts +1 -0
  11. package/dist-types/models/AmplifyServiceException.d.ts +10 -0
  12. package/dist-types/models/models_0.d.ts +51 -29
  13. package/dist-types/ts3.4/Amplify.d.ts +190 -0
  14. package/dist-types/ts3.4/AmplifyClient.d.ts +110 -0
  15. package/dist-types/ts3.4/commands/CreateAppCommand.d.ts +17 -0
  16. package/dist-types/ts3.4/commands/CreateBackendEnvironmentCommand.d.ts +17 -0
  17. package/dist-types/ts3.4/commands/CreateBranchCommand.d.ts +17 -0
  18. package/dist-types/ts3.4/commands/CreateDeploymentCommand.d.ts +17 -0
  19. package/dist-types/ts3.4/commands/CreateDomainAssociationCommand.d.ts +17 -0
  20. package/dist-types/ts3.4/commands/CreateWebhookCommand.d.ts +17 -0
  21. package/dist-types/ts3.4/commands/DeleteAppCommand.d.ts +17 -0
  22. package/dist-types/ts3.4/commands/DeleteBackendEnvironmentCommand.d.ts +17 -0
  23. package/dist-types/ts3.4/commands/DeleteBranchCommand.d.ts +17 -0
  24. package/dist-types/ts3.4/commands/DeleteDomainAssociationCommand.d.ts +17 -0
  25. package/dist-types/ts3.4/commands/DeleteJobCommand.d.ts +17 -0
  26. package/dist-types/ts3.4/commands/DeleteWebhookCommand.d.ts +17 -0
  27. package/dist-types/ts3.4/commands/GenerateAccessLogsCommand.d.ts +17 -0
  28. package/dist-types/ts3.4/commands/GetAppCommand.d.ts +17 -0
  29. package/dist-types/ts3.4/commands/GetArtifactUrlCommand.d.ts +17 -0
  30. package/dist-types/ts3.4/commands/GetBackendEnvironmentCommand.d.ts +17 -0
  31. package/dist-types/ts3.4/commands/GetBranchCommand.d.ts +17 -0
  32. package/dist-types/ts3.4/commands/GetDomainAssociationCommand.d.ts +17 -0
  33. package/dist-types/ts3.4/commands/GetJobCommand.d.ts +17 -0
  34. package/dist-types/ts3.4/commands/GetWebhookCommand.d.ts +17 -0
  35. package/dist-types/ts3.4/commands/ListAppsCommand.d.ts +17 -0
  36. package/dist-types/ts3.4/commands/ListArtifactsCommand.d.ts +17 -0
  37. package/dist-types/ts3.4/commands/ListBackendEnvironmentsCommand.d.ts +17 -0
  38. package/dist-types/ts3.4/commands/ListBranchesCommand.d.ts +17 -0
  39. package/dist-types/ts3.4/commands/ListDomainAssociationsCommand.d.ts +17 -0
  40. package/dist-types/ts3.4/commands/ListJobsCommand.d.ts +17 -0
  41. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  42. package/dist-types/ts3.4/commands/ListWebhooksCommand.d.ts +17 -0
  43. package/dist-types/ts3.4/commands/StartDeploymentCommand.d.ts +17 -0
  44. package/dist-types/ts3.4/commands/StartJobCommand.d.ts +17 -0
  45. package/dist-types/ts3.4/commands/StopJobCommand.d.ts +17 -0
  46. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  47. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  48. package/dist-types/ts3.4/commands/UpdateAppCommand.d.ts +17 -0
  49. package/dist-types/ts3.4/commands/UpdateBranchCommand.d.ts +17 -0
  50. package/dist-types/ts3.4/commands/UpdateDomainAssociationCommand.d.ts +17 -0
  51. package/dist-types/ts3.4/commands/UpdateWebhookCommand.d.ts +17 -0
  52. package/dist-types/ts3.4/commands/index.d.ts +37 -0
  53. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  54. package/dist-types/ts3.4/index.d.ts +5 -0
  55. package/dist-types/ts3.4/models/AmplifyServiceException.d.ts +6 -0
  56. package/dist-types/ts3.4/models/index.d.ts +1 -0
  57. package/dist-types/ts3.4/models/models_0.d.ts +1396 -0
  58. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +113 -0
  59. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +38 -0
  60. package/dist-types/ts3.4/runtimeConfig.d.ts +38 -0
  61. package/dist-types/ts3.4/runtimeConfig.native.d.ts +37 -0
  62. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  63. package/package.json +33 -33
@@ -4,6 +4,8 @@ exports.deserializeAws_restJson1GenerateAccessLogsCommand = exports.deserializeA
4
4
  exports.deserializeAws_restJson1UpdateWebhookCommand = exports.deserializeAws_restJson1UpdateDomainAssociationCommand = exports.deserializeAws_restJson1UpdateBranchCommand = exports.deserializeAws_restJson1UpdateAppCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StopJobCommand = exports.deserializeAws_restJson1StartJobCommand = exports.deserializeAws_restJson1StartDeploymentCommand = exports.deserializeAws_restJson1ListWebhooksCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListJobsCommand = exports.deserializeAws_restJson1ListDomainAssociationsCommand = exports.deserializeAws_restJson1ListBranchesCommand = exports.deserializeAws_restJson1ListBackendEnvironmentsCommand = exports.deserializeAws_restJson1ListArtifactsCommand = exports.deserializeAws_restJson1ListAppsCommand = exports.deserializeAws_restJson1GetWebhookCommand = exports.deserializeAws_restJson1GetJobCommand = exports.deserializeAws_restJson1GetDomainAssociationCommand = exports.deserializeAws_restJson1GetBranchCommand = exports.deserializeAws_restJson1GetBackendEnvironmentCommand = exports.deserializeAws_restJson1GetArtifactUrlCommand = exports.deserializeAws_restJson1GetAppCommand = 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 AmplifyServiceException_1 = require("../models/AmplifyServiceException");
8
+ const models_0_1 = require("../models/models_0");
7
9
  const serializeAws_restJson1CreateAppCommand = async (input, context) => {
8
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
9
11
  const headers = {
@@ -1450,59 +1452,28 @@ const deserializeAws_restJson1CreateAppCommandError = async (output, context) =>
1450
1452
  switch (errorCode) {
1451
1453
  case "BadRequestException":
1452
1454
  case "com.amazonaws.amplify#BadRequestException":
1453
- response = {
1454
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1455
- name: errorCode,
1456
- $metadata: deserializeMetadata(output),
1457
- };
1458
- break;
1455
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1459
1456
  case "DependentServiceFailureException":
1460
1457
  case "com.amazonaws.amplify#DependentServiceFailureException":
1461
- response = {
1462
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
1463
- name: errorCode,
1464
- $metadata: deserializeMetadata(output),
1465
- };
1466
- break;
1458
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
1467
1459
  case "InternalFailureException":
1468
1460
  case "com.amazonaws.amplify#InternalFailureException":
1469
- response = {
1470
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1471
- name: errorCode,
1472
- $metadata: deserializeMetadata(output),
1473
- };
1474
- break;
1461
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1475
1462
  case "LimitExceededException":
1476
1463
  case "com.amazonaws.amplify#LimitExceededException":
1477
- response = {
1478
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1479
- name: errorCode,
1480
- $metadata: deserializeMetadata(output),
1481
- };
1482
- break;
1464
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1483
1465
  case "UnauthorizedException":
1484
1466
  case "com.amazonaws.amplify#UnauthorizedException":
1485
- response = {
1486
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1487
- name: errorCode,
1488
- $metadata: deserializeMetadata(output),
1489
- };
1490
- break;
1467
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1491
1468
  default:
1492
1469
  const parsedBody = parsedOutput.body;
1493
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1494
- response = {
1495
- ...parsedBody,
1496
- name: `${errorCode}`,
1497
- message: parsedBody.message || parsedBody.Message || errorCode,
1470
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1471
+ name: parsedBody.code || parsedBody.Code || errorCode,
1498
1472
  $fault: "client",
1499
1473
  $metadata: deserializeMetadata(output),
1500
- };
1474
+ });
1475
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1501
1476
  }
1502
- const message = response.message || response.Message || errorCode;
1503
- response.message = message;
1504
- delete response.Message;
1505
- return Promise.reject(Object.assign(new Error(message), response));
1506
1477
  };
1507
1478
  const deserializeAws_restJson1CreateBackendEnvironmentCommand = async (output, context) => {
1508
1479
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1530,59 +1501,28 @@ const deserializeAws_restJson1CreateBackendEnvironmentCommandError = async (outp
1530
1501
  switch (errorCode) {
1531
1502
  case "BadRequestException":
1532
1503
  case "com.amazonaws.amplify#BadRequestException":
1533
- response = {
1534
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1535
- name: errorCode,
1536
- $metadata: deserializeMetadata(output),
1537
- };
1538
- break;
1504
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1539
1505
  case "InternalFailureException":
1540
1506
  case "com.amazonaws.amplify#InternalFailureException":
1541
- response = {
1542
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1543
- name: errorCode,
1544
- $metadata: deserializeMetadata(output),
1545
- };
1546
- break;
1507
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1547
1508
  case "LimitExceededException":
1548
1509
  case "com.amazonaws.amplify#LimitExceededException":
1549
- response = {
1550
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1551
- name: errorCode,
1552
- $metadata: deserializeMetadata(output),
1553
- };
1554
- break;
1510
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1555
1511
  case "NotFoundException":
1556
1512
  case "com.amazonaws.amplify#NotFoundException":
1557
- response = {
1558
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1559
- name: errorCode,
1560
- $metadata: deserializeMetadata(output),
1561
- };
1562
- break;
1513
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1563
1514
  case "UnauthorizedException":
1564
1515
  case "com.amazonaws.amplify#UnauthorizedException":
1565
- response = {
1566
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1567
- name: errorCode,
1568
- $metadata: deserializeMetadata(output),
1569
- };
1570
- break;
1516
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1571
1517
  default:
1572
1518
  const parsedBody = parsedOutput.body;
1573
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1574
- response = {
1575
- ...parsedBody,
1576
- name: `${errorCode}`,
1577
- message: parsedBody.message || parsedBody.Message || errorCode,
1519
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1520
+ name: parsedBody.code || parsedBody.Code || errorCode,
1578
1521
  $fault: "client",
1579
1522
  $metadata: deserializeMetadata(output),
1580
- };
1523
+ });
1524
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1581
1525
  }
1582
- const message = response.message || response.Message || errorCode;
1583
- response.message = message;
1584
- delete response.Message;
1585
- return Promise.reject(Object.assign(new Error(message), response));
1586
1526
  };
1587
1527
  const deserializeAws_restJson1CreateBranchCommand = async (output, context) => {
1588
1528
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1610,67 +1550,31 @@ const deserializeAws_restJson1CreateBranchCommandError = async (output, context)
1610
1550
  switch (errorCode) {
1611
1551
  case "BadRequestException":
1612
1552
  case "com.amazonaws.amplify#BadRequestException":
1613
- response = {
1614
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1615
- name: errorCode,
1616
- $metadata: deserializeMetadata(output),
1617
- };
1618
- break;
1553
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1619
1554
  case "DependentServiceFailureException":
1620
1555
  case "com.amazonaws.amplify#DependentServiceFailureException":
1621
- response = {
1622
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
1623
- name: errorCode,
1624
- $metadata: deserializeMetadata(output),
1625
- };
1626
- break;
1556
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
1627
1557
  case "InternalFailureException":
1628
1558
  case "com.amazonaws.amplify#InternalFailureException":
1629
- response = {
1630
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1631
- name: errorCode,
1632
- $metadata: deserializeMetadata(output),
1633
- };
1634
- break;
1559
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1635
1560
  case "LimitExceededException":
1636
1561
  case "com.amazonaws.amplify#LimitExceededException":
1637
- response = {
1638
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1639
- name: errorCode,
1640
- $metadata: deserializeMetadata(output),
1641
- };
1642
- break;
1562
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1643
1563
  case "NotFoundException":
1644
1564
  case "com.amazonaws.amplify#NotFoundException":
1645
- response = {
1646
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1647
- name: errorCode,
1648
- $metadata: deserializeMetadata(output),
1649
- };
1650
- break;
1565
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1651
1566
  case "UnauthorizedException":
1652
1567
  case "com.amazonaws.amplify#UnauthorizedException":
1653
- response = {
1654
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1655
- name: errorCode,
1656
- $metadata: deserializeMetadata(output),
1657
- };
1658
- break;
1568
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1659
1569
  default:
1660
1570
  const parsedBody = parsedOutput.body;
1661
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1662
- response = {
1663
- ...parsedBody,
1664
- name: `${errorCode}`,
1665
- message: parsedBody.message || parsedBody.Message || errorCode,
1571
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1572
+ name: parsedBody.code || parsedBody.Code || errorCode,
1666
1573
  $fault: "client",
1667
1574
  $metadata: deserializeMetadata(output),
1668
- };
1575
+ });
1576
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1669
1577
  }
1670
- const message = response.message || response.Message || errorCode;
1671
- response.message = message;
1672
- delete response.Message;
1673
- return Promise.reject(Object.assign(new Error(message), response));
1674
1578
  };
1675
1579
  const deserializeAws_restJson1CreateDeploymentCommand = async (output, context) => {
1676
1580
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1706,51 +1610,25 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1706
1610
  switch (errorCode) {
1707
1611
  case "BadRequestException":
1708
1612
  case "com.amazonaws.amplify#BadRequestException":
1709
- response = {
1710
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1711
- name: errorCode,
1712
- $metadata: deserializeMetadata(output),
1713
- };
1714
- break;
1613
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1715
1614
  case "InternalFailureException":
1716
1615
  case "com.amazonaws.amplify#InternalFailureException":
1717
- response = {
1718
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1719
- name: errorCode,
1720
- $metadata: deserializeMetadata(output),
1721
- };
1722
- break;
1616
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1723
1617
  case "LimitExceededException":
1724
1618
  case "com.amazonaws.amplify#LimitExceededException":
1725
- response = {
1726
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1727
- name: errorCode,
1728
- $metadata: deserializeMetadata(output),
1729
- };
1730
- break;
1619
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1731
1620
  case "UnauthorizedException":
1732
1621
  case "com.amazonaws.amplify#UnauthorizedException":
1733
- response = {
1734
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1735
- name: errorCode,
1736
- $metadata: deserializeMetadata(output),
1737
- };
1738
- break;
1622
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1739
1623
  default:
1740
1624
  const parsedBody = parsedOutput.body;
1741
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1742
- response = {
1743
- ...parsedBody,
1744
- name: `${errorCode}`,
1745
- message: parsedBody.message || parsedBody.Message || errorCode,
1625
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1626
+ name: parsedBody.code || parsedBody.Code || errorCode,
1746
1627
  $fault: "client",
1747
1628
  $metadata: deserializeMetadata(output),
1748
- };
1629
+ });
1630
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1749
1631
  }
1750
- const message = response.message || response.Message || errorCode;
1751
- response.message = message;
1752
- delete response.Message;
1753
- return Promise.reject(Object.assign(new Error(message), response));
1754
1632
  };
1755
1633
  const deserializeAws_restJson1CreateDomainAssociationCommand = async (output, context) => {
1756
1634
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1778,67 +1656,31 @@ const deserializeAws_restJson1CreateDomainAssociationCommandError = async (outpu
1778
1656
  switch (errorCode) {
1779
1657
  case "BadRequestException":
1780
1658
  case "com.amazonaws.amplify#BadRequestException":
1781
- response = {
1782
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1783
- name: errorCode,
1784
- $metadata: deserializeMetadata(output),
1785
- };
1786
- break;
1659
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1787
1660
  case "DependentServiceFailureException":
1788
1661
  case "com.amazonaws.amplify#DependentServiceFailureException":
1789
- response = {
1790
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
1791
- name: errorCode,
1792
- $metadata: deserializeMetadata(output),
1793
- };
1794
- break;
1662
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
1795
1663
  case "InternalFailureException":
1796
1664
  case "com.amazonaws.amplify#InternalFailureException":
1797
- response = {
1798
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1799
- name: errorCode,
1800
- $metadata: deserializeMetadata(output),
1801
- };
1802
- break;
1665
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1803
1666
  case "LimitExceededException":
1804
1667
  case "com.amazonaws.amplify#LimitExceededException":
1805
- response = {
1806
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1807
- name: errorCode,
1808
- $metadata: deserializeMetadata(output),
1809
- };
1810
- break;
1668
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1811
1669
  case "NotFoundException":
1812
1670
  case "com.amazonaws.amplify#NotFoundException":
1813
- response = {
1814
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1815
- name: errorCode,
1816
- $metadata: deserializeMetadata(output),
1817
- };
1818
- break;
1671
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1819
1672
  case "UnauthorizedException":
1820
1673
  case "com.amazonaws.amplify#UnauthorizedException":
1821
- response = {
1822
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1823
- name: errorCode,
1824
- $metadata: deserializeMetadata(output),
1825
- };
1826
- break;
1674
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1827
1675
  default:
1828
1676
  const parsedBody = parsedOutput.body;
1829
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1830
- response = {
1831
- ...parsedBody,
1832
- name: `${errorCode}`,
1833
- message: parsedBody.message || parsedBody.Message || errorCode,
1677
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1678
+ name: parsedBody.code || parsedBody.Code || errorCode,
1834
1679
  $fault: "client",
1835
1680
  $metadata: deserializeMetadata(output),
1836
- };
1681
+ });
1682
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1837
1683
  }
1838
- const message = response.message || response.Message || errorCode;
1839
- response.message = message;
1840
- delete response.Message;
1841
- return Promise.reject(Object.assign(new Error(message), response));
1842
1684
  };
1843
1685
  const deserializeAws_restJson1CreateWebhookCommand = async (output, context) => {
1844
1686
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1866,67 +1708,31 @@ const deserializeAws_restJson1CreateWebhookCommandError = async (output, context
1866
1708
  switch (errorCode) {
1867
1709
  case "BadRequestException":
1868
1710
  case "com.amazonaws.amplify#BadRequestException":
1869
- response = {
1870
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1871
- name: errorCode,
1872
- $metadata: deserializeMetadata(output),
1873
- };
1874
- break;
1711
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1875
1712
  case "DependentServiceFailureException":
1876
1713
  case "com.amazonaws.amplify#DependentServiceFailureException":
1877
- response = {
1878
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
1879
- name: errorCode,
1880
- $metadata: deserializeMetadata(output),
1881
- };
1882
- break;
1714
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
1883
1715
  case "InternalFailureException":
1884
1716
  case "com.amazonaws.amplify#InternalFailureException":
1885
- response = {
1886
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1887
- name: errorCode,
1888
- $metadata: deserializeMetadata(output),
1889
- };
1890
- break;
1717
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1891
1718
  case "LimitExceededException":
1892
1719
  case "com.amazonaws.amplify#LimitExceededException":
1893
- response = {
1894
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
1895
- name: errorCode,
1896
- $metadata: deserializeMetadata(output),
1897
- };
1898
- break;
1720
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
1899
1721
  case "NotFoundException":
1900
1722
  case "com.amazonaws.amplify#NotFoundException":
1901
- response = {
1902
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1903
- name: errorCode,
1904
- $metadata: deserializeMetadata(output),
1905
- };
1906
- break;
1723
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1907
1724
  case "UnauthorizedException":
1908
1725
  case "com.amazonaws.amplify#UnauthorizedException":
1909
- response = {
1910
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1911
- name: errorCode,
1912
- $metadata: deserializeMetadata(output),
1913
- };
1914
- break;
1726
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1915
1727
  default:
1916
1728
  const parsedBody = parsedOutput.body;
1917
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1918
- response = {
1919
- ...parsedBody,
1920
- name: `${errorCode}`,
1921
- message: parsedBody.message || parsedBody.Message || errorCode,
1729
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1730
+ name: parsedBody.code || parsedBody.Code || errorCode,
1922
1731
  $fault: "client",
1923
1732
  $metadata: deserializeMetadata(output),
1924
- };
1733
+ });
1734
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1925
1735
  }
1926
- const message = response.message || response.Message || errorCode;
1927
- response.message = message;
1928
- delete response.Message;
1929
- return Promise.reject(Object.assign(new Error(message), response));
1930
1736
  };
1931
1737
  const deserializeAws_restJson1DeleteAppCommand = async (output, context) => {
1932
1738
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1954,59 +1760,28 @@ const deserializeAws_restJson1DeleteAppCommandError = async (output, context) =>
1954
1760
  switch (errorCode) {
1955
1761
  case "BadRequestException":
1956
1762
  case "com.amazonaws.amplify#BadRequestException":
1957
- response = {
1958
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
1959
- name: errorCode,
1960
- $metadata: deserializeMetadata(output),
1961
- };
1962
- break;
1763
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
1963
1764
  case "DependentServiceFailureException":
1964
1765
  case "com.amazonaws.amplify#DependentServiceFailureException":
1965
- response = {
1966
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
1967
- name: errorCode,
1968
- $metadata: deserializeMetadata(output),
1969
- };
1970
- break;
1766
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
1971
1767
  case "InternalFailureException":
1972
1768
  case "com.amazonaws.amplify#InternalFailureException":
1973
- response = {
1974
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
1975
- name: errorCode,
1976
- $metadata: deserializeMetadata(output),
1977
- };
1978
- break;
1769
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
1979
1770
  case "NotFoundException":
1980
1771
  case "com.amazonaws.amplify#NotFoundException":
1981
- response = {
1982
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
1983
- name: errorCode,
1984
- $metadata: deserializeMetadata(output),
1985
- };
1986
- break;
1772
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
1987
1773
  case "UnauthorizedException":
1988
1774
  case "com.amazonaws.amplify#UnauthorizedException":
1989
- response = {
1990
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
1991
- name: errorCode,
1992
- $metadata: deserializeMetadata(output),
1993
- };
1994
- break;
1775
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
1995
1776
  default:
1996
1777
  const parsedBody = parsedOutput.body;
1997
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1998
- response = {
1999
- ...parsedBody,
2000
- name: `${errorCode}`,
2001
- message: parsedBody.message || parsedBody.Message || errorCode,
1778
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1779
+ name: parsedBody.code || parsedBody.Code || errorCode,
2002
1780
  $fault: "client",
2003
1781
  $metadata: deserializeMetadata(output),
2004
- };
1782
+ });
1783
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2005
1784
  }
2006
- const message = response.message || response.Message || errorCode;
2007
- response.message = message;
2008
- delete response.Message;
2009
- return Promise.reject(Object.assign(new Error(message), response));
2010
1785
  };
2011
1786
  const deserializeAws_restJson1DeleteBackendEnvironmentCommand = async (output, context) => {
2012
1787
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2034,59 +1809,28 @@ const deserializeAws_restJson1DeleteBackendEnvironmentCommandError = async (outp
2034
1809
  switch (errorCode) {
2035
1810
  case "BadRequestException":
2036
1811
  case "com.amazonaws.amplify#BadRequestException":
2037
- response = {
2038
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2039
- name: errorCode,
2040
- $metadata: deserializeMetadata(output),
2041
- };
2042
- break;
1812
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2043
1813
  case "DependentServiceFailureException":
2044
1814
  case "com.amazonaws.amplify#DependentServiceFailureException":
2045
- response = {
2046
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
2047
- name: errorCode,
2048
- $metadata: deserializeMetadata(output),
2049
- };
2050
- break;
1815
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
2051
1816
  case "InternalFailureException":
2052
1817
  case "com.amazonaws.amplify#InternalFailureException":
2053
- response = {
2054
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2055
- name: errorCode,
2056
- $metadata: deserializeMetadata(output),
2057
- };
2058
- break;
1818
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2059
1819
  case "NotFoundException":
2060
1820
  case "com.amazonaws.amplify#NotFoundException":
2061
- response = {
2062
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2063
- name: errorCode,
2064
- $metadata: deserializeMetadata(output),
2065
- };
2066
- break;
1821
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2067
1822
  case "UnauthorizedException":
2068
1823
  case "com.amazonaws.amplify#UnauthorizedException":
2069
- response = {
2070
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2071
- name: errorCode,
2072
- $metadata: deserializeMetadata(output),
2073
- };
2074
- break;
1824
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2075
1825
  default:
2076
1826
  const parsedBody = parsedOutput.body;
2077
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2078
- response = {
2079
- ...parsedBody,
2080
- name: `${errorCode}`,
2081
- message: parsedBody.message || parsedBody.Message || errorCode,
1827
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1828
+ name: parsedBody.code || parsedBody.Code || errorCode,
2082
1829
  $fault: "client",
2083
1830
  $metadata: deserializeMetadata(output),
2084
- };
1831
+ });
1832
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2085
1833
  }
2086
- const message = response.message || response.Message || errorCode;
2087
- response.message = message;
2088
- delete response.Message;
2089
- return Promise.reject(Object.assign(new Error(message), response));
2090
1834
  };
2091
1835
  const deserializeAws_restJson1DeleteBranchCommand = async (output, context) => {
2092
1836
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2114,59 +1858,28 @@ const deserializeAws_restJson1DeleteBranchCommandError = async (output, context)
2114
1858
  switch (errorCode) {
2115
1859
  case "BadRequestException":
2116
1860
  case "com.amazonaws.amplify#BadRequestException":
2117
- response = {
2118
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2119
- name: errorCode,
2120
- $metadata: deserializeMetadata(output),
2121
- };
2122
- break;
1861
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2123
1862
  case "DependentServiceFailureException":
2124
1863
  case "com.amazonaws.amplify#DependentServiceFailureException":
2125
- response = {
2126
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
2127
- name: errorCode,
2128
- $metadata: deserializeMetadata(output),
2129
- };
2130
- break;
1864
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
2131
1865
  case "InternalFailureException":
2132
1866
  case "com.amazonaws.amplify#InternalFailureException":
2133
- response = {
2134
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2135
- name: errorCode,
2136
- $metadata: deserializeMetadata(output),
2137
- };
2138
- break;
1867
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2139
1868
  case "NotFoundException":
2140
1869
  case "com.amazonaws.amplify#NotFoundException":
2141
- response = {
2142
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2143
- name: errorCode,
2144
- $metadata: deserializeMetadata(output),
2145
- };
2146
- break;
1870
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2147
1871
  case "UnauthorizedException":
2148
1872
  case "com.amazonaws.amplify#UnauthorizedException":
2149
- response = {
2150
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2151
- name: errorCode,
2152
- $metadata: deserializeMetadata(output),
2153
- };
2154
- break;
1873
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2155
1874
  default:
2156
1875
  const parsedBody = parsedOutput.body;
2157
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2158
- response = {
2159
- ...parsedBody,
2160
- name: `${errorCode}`,
2161
- message: parsedBody.message || parsedBody.Message || errorCode,
1876
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1877
+ name: parsedBody.code || parsedBody.Code || errorCode,
2162
1878
  $fault: "client",
2163
1879
  $metadata: deserializeMetadata(output),
2164
- };
1880
+ });
1881
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2165
1882
  }
2166
- const message = response.message || response.Message || errorCode;
2167
- response.message = message;
2168
- delete response.Message;
2169
- return Promise.reject(Object.assign(new Error(message), response));
2170
1883
  };
2171
1884
  const deserializeAws_restJson1DeleteDomainAssociationCommand = async (output, context) => {
2172
1885
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2194,59 +1907,28 @@ const deserializeAws_restJson1DeleteDomainAssociationCommandError = async (outpu
2194
1907
  switch (errorCode) {
2195
1908
  case "BadRequestException":
2196
1909
  case "com.amazonaws.amplify#BadRequestException":
2197
- response = {
2198
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2199
- name: errorCode,
2200
- $metadata: deserializeMetadata(output),
2201
- };
2202
- break;
1910
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2203
1911
  case "DependentServiceFailureException":
2204
1912
  case "com.amazonaws.amplify#DependentServiceFailureException":
2205
- response = {
2206
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
2207
- name: errorCode,
2208
- $metadata: deserializeMetadata(output),
2209
- };
2210
- break;
1913
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
2211
1914
  case "InternalFailureException":
2212
1915
  case "com.amazonaws.amplify#InternalFailureException":
2213
- response = {
2214
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2215
- name: errorCode,
2216
- $metadata: deserializeMetadata(output),
2217
- };
2218
- break;
1916
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2219
1917
  case "NotFoundException":
2220
1918
  case "com.amazonaws.amplify#NotFoundException":
2221
- response = {
2222
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2223
- name: errorCode,
2224
- $metadata: deserializeMetadata(output),
2225
- };
2226
- break;
1919
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2227
1920
  case "UnauthorizedException":
2228
1921
  case "com.amazonaws.amplify#UnauthorizedException":
2229
- response = {
2230
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2231
- name: errorCode,
2232
- $metadata: deserializeMetadata(output),
2233
- };
2234
- break;
1922
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2235
1923
  default:
2236
1924
  const parsedBody = parsedOutput.body;
2237
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2238
- response = {
2239
- ...parsedBody,
2240
- name: `${errorCode}`,
2241
- message: parsedBody.message || parsedBody.Message || errorCode,
1925
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1926
+ name: parsedBody.code || parsedBody.Code || errorCode,
2242
1927
  $fault: "client",
2243
1928
  $metadata: deserializeMetadata(output),
2244
- };
1929
+ });
1930
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2245
1931
  }
2246
- const message = response.message || response.Message || errorCode;
2247
- response.message = message;
2248
- delete response.Message;
2249
- return Promise.reject(Object.assign(new Error(message), response));
2250
1932
  };
2251
1933
  const deserializeAws_restJson1DeleteJobCommand = async (output, context) => {
2252
1934
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2274,59 +1956,28 @@ const deserializeAws_restJson1DeleteJobCommandError = async (output, context) =>
2274
1956
  switch (errorCode) {
2275
1957
  case "BadRequestException":
2276
1958
  case "com.amazonaws.amplify#BadRequestException":
2277
- response = {
2278
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2279
- name: errorCode,
2280
- $metadata: deserializeMetadata(output),
2281
- };
2282
- break;
1959
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2283
1960
  case "InternalFailureException":
2284
1961
  case "com.amazonaws.amplify#InternalFailureException":
2285
- response = {
2286
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2287
- name: errorCode,
2288
- $metadata: deserializeMetadata(output),
2289
- };
2290
- break;
1962
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2291
1963
  case "LimitExceededException":
2292
1964
  case "com.amazonaws.amplify#LimitExceededException":
2293
- response = {
2294
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2295
- name: errorCode,
2296
- $metadata: deserializeMetadata(output),
2297
- };
2298
- break;
1965
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2299
1966
  case "NotFoundException":
2300
1967
  case "com.amazonaws.amplify#NotFoundException":
2301
- response = {
2302
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2303
- name: errorCode,
2304
- $metadata: deserializeMetadata(output),
2305
- };
2306
- break;
1968
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2307
1969
  case "UnauthorizedException":
2308
1970
  case "com.amazonaws.amplify#UnauthorizedException":
2309
- response = {
2310
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2311
- name: errorCode,
2312
- $metadata: deserializeMetadata(output),
2313
- };
2314
- break;
1971
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2315
1972
  default:
2316
1973
  const parsedBody = parsedOutput.body;
2317
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2318
- response = {
2319
- ...parsedBody,
2320
- name: `${errorCode}`,
2321
- message: parsedBody.message || parsedBody.Message || errorCode,
1974
+ response = new AmplifyServiceException_1.AmplifyServiceException({
1975
+ name: parsedBody.code || parsedBody.Code || errorCode,
2322
1976
  $fault: "client",
2323
1977
  $metadata: deserializeMetadata(output),
2324
- };
1978
+ });
1979
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2325
1980
  }
2326
- const message = response.message || response.Message || errorCode;
2327
- response.message = message;
2328
- delete response.Message;
2329
- return Promise.reject(Object.assign(new Error(message), response));
2330
1981
  };
2331
1982
  const deserializeAws_restJson1DeleteWebhookCommand = async (output, context) => {
2332
1983
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2354,59 +2005,28 @@ const deserializeAws_restJson1DeleteWebhookCommandError = async (output, context
2354
2005
  switch (errorCode) {
2355
2006
  case "BadRequestException":
2356
2007
  case "com.amazonaws.amplify#BadRequestException":
2357
- response = {
2358
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2359
- name: errorCode,
2360
- $metadata: deserializeMetadata(output),
2361
- };
2362
- break;
2008
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2363
2009
  case "InternalFailureException":
2364
2010
  case "com.amazonaws.amplify#InternalFailureException":
2365
- response = {
2366
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2367
- name: errorCode,
2368
- $metadata: deserializeMetadata(output),
2369
- };
2370
- break;
2011
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2371
2012
  case "LimitExceededException":
2372
2013
  case "com.amazonaws.amplify#LimitExceededException":
2373
- response = {
2374
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2375
- name: errorCode,
2376
- $metadata: deserializeMetadata(output),
2377
- };
2378
- break;
2014
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2379
2015
  case "NotFoundException":
2380
2016
  case "com.amazonaws.amplify#NotFoundException":
2381
- response = {
2382
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2383
- name: errorCode,
2384
- $metadata: deserializeMetadata(output),
2385
- };
2386
- break;
2017
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2387
2018
  case "UnauthorizedException":
2388
2019
  case "com.amazonaws.amplify#UnauthorizedException":
2389
- response = {
2390
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2391
- name: errorCode,
2392
- $metadata: deserializeMetadata(output),
2393
- };
2394
- break;
2020
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2395
2021
  default:
2396
2022
  const parsedBody = parsedOutput.body;
2397
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2398
- response = {
2399
- ...parsedBody,
2400
- name: `${errorCode}`,
2401
- message: parsedBody.message || parsedBody.Message || errorCode,
2023
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2024
+ name: parsedBody.code || parsedBody.Code || errorCode,
2402
2025
  $fault: "client",
2403
2026
  $metadata: deserializeMetadata(output),
2404
- };
2027
+ });
2028
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2405
2029
  }
2406
- const message = response.message || response.Message || errorCode;
2407
- response.message = message;
2408
- delete response.Message;
2409
- return Promise.reject(Object.assign(new Error(message), response));
2410
2030
  };
2411
2031
  const deserializeAws_restJson1GenerateAccessLogsCommand = async (output, context) => {
2412
2032
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2434,51 +2054,25 @@ const deserializeAws_restJson1GenerateAccessLogsCommandError = async (output, co
2434
2054
  switch (errorCode) {
2435
2055
  case "BadRequestException":
2436
2056
  case "com.amazonaws.amplify#BadRequestException":
2437
- response = {
2438
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2439
- name: errorCode,
2440
- $metadata: deserializeMetadata(output),
2441
- };
2442
- break;
2057
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2443
2058
  case "InternalFailureException":
2444
2059
  case "com.amazonaws.amplify#InternalFailureException":
2445
- response = {
2446
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2447
- name: errorCode,
2448
- $metadata: deserializeMetadata(output),
2449
- };
2450
- break;
2060
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2451
2061
  case "NotFoundException":
2452
2062
  case "com.amazonaws.amplify#NotFoundException":
2453
- response = {
2454
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2455
- name: errorCode,
2456
- $metadata: deserializeMetadata(output),
2457
- };
2458
- break;
2063
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2459
2064
  case "UnauthorizedException":
2460
2065
  case "com.amazonaws.amplify#UnauthorizedException":
2461
- response = {
2462
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2463
- name: errorCode,
2464
- $metadata: deserializeMetadata(output),
2465
- };
2466
- break;
2066
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2467
2067
  default:
2468
2068
  const parsedBody = parsedOutput.body;
2469
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2470
- response = {
2471
- ...parsedBody,
2472
- name: `${errorCode}`,
2473
- message: parsedBody.message || parsedBody.Message || errorCode,
2069
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2070
+ name: parsedBody.code || parsedBody.Code || errorCode,
2474
2071
  $fault: "client",
2475
2072
  $metadata: deserializeMetadata(output),
2476
- };
2073
+ });
2074
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2477
2075
  }
2478
- const message = response.message || response.Message || errorCode;
2479
- response.message = message;
2480
- delete response.Message;
2481
- return Promise.reject(Object.assign(new Error(message), response));
2482
2076
  };
2483
2077
  const deserializeAws_restJson1GetAppCommand = async (output, context) => {
2484
2078
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2506,51 +2100,25 @@ const deserializeAws_restJson1GetAppCommandError = async (output, context) => {
2506
2100
  switch (errorCode) {
2507
2101
  case "BadRequestException":
2508
2102
  case "com.amazonaws.amplify#BadRequestException":
2509
- response = {
2510
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2511
- name: errorCode,
2512
- $metadata: deserializeMetadata(output),
2513
- };
2514
- break;
2103
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2515
2104
  case "InternalFailureException":
2516
2105
  case "com.amazonaws.amplify#InternalFailureException":
2517
- response = {
2518
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2519
- name: errorCode,
2520
- $metadata: deserializeMetadata(output),
2521
- };
2522
- break;
2106
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2523
2107
  case "NotFoundException":
2524
2108
  case "com.amazonaws.amplify#NotFoundException":
2525
- response = {
2526
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2527
- name: errorCode,
2528
- $metadata: deserializeMetadata(output),
2529
- };
2530
- break;
2109
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2531
2110
  case "UnauthorizedException":
2532
2111
  case "com.amazonaws.amplify#UnauthorizedException":
2533
- response = {
2534
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2535
- name: errorCode,
2536
- $metadata: deserializeMetadata(output),
2537
- };
2538
- break;
2112
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2539
2113
  default:
2540
2114
  const parsedBody = parsedOutput.body;
2541
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2542
- response = {
2543
- ...parsedBody,
2544
- name: `${errorCode}`,
2545
- message: parsedBody.message || parsedBody.Message || errorCode,
2115
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2116
+ name: parsedBody.code || parsedBody.Code || errorCode,
2546
2117
  $fault: "client",
2547
2118
  $metadata: deserializeMetadata(output),
2548
- };
2119
+ });
2120
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2549
2121
  }
2550
- const message = response.message || response.Message || errorCode;
2551
- response.message = message;
2552
- delete response.Message;
2553
- return Promise.reject(Object.assign(new Error(message), response));
2554
2122
  };
2555
2123
  const deserializeAws_restJson1GetArtifactUrlCommand = async (output, context) => {
2556
2124
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2582,59 +2150,28 @@ const deserializeAws_restJson1GetArtifactUrlCommandError = async (output, contex
2582
2150
  switch (errorCode) {
2583
2151
  case "BadRequestException":
2584
2152
  case "com.amazonaws.amplify#BadRequestException":
2585
- response = {
2586
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2587
- name: errorCode,
2588
- $metadata: deserializeMetadata(output),
2589
- };
2590
- break;
2153
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2591
2154
  case "InternalFailureException":
2592
2155
  case "com.amazonaws.amplify#InternalFailureException":
2593
- response = {
2594
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2595
- name: errorCode,
2596
- $metadata: deserializeMetadata(output),
2597
- };
2598
- break;
2156
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2599
2157
  case "LimitExceededException":
2600
2158
  case "com.amazonaws.amplify#LimitExceededException":
2601
- response = {
2602
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2603
- name: errorCode,
2604
- $metadata: deserializeMetadata(output),
2605
- };
2606
- break;
2159
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2607
2160
  case "NotFoundException":
2608
2161
  case "com.amazonaws.amplify#NotFoundException":
2609
- response = {
2610
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2611
- name: errorCode,
2612
- $metadata: deserializeMetadata(output),
2613
- };
2614
- break;
2162
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2615
2163
  case "UnauthorizedException":
2616
2164
  case "com.amazonaws.amplify#UnauthorizedException":
2617
- response = {
2618
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2619
- name: errorCode,
2620
- $metadata: deserializeMetadata(output),
2621
- };
2622
- break;
2165
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2623
2166
  default:
2624
2167
  const parsedBody = parsedOutput.body;
2625
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2626
- response = {
2627
- ...parsedBody,
2628
- name: `${errorCode}`,
2629
- message: parsedBody.message || parsedBody.Message || errorCode,
2168
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2169
+ name: parsedBody.code || parsedBody.Code || errorCode,
2630
2170
  $fault: "client",
2631
2171
  $metadata: deserializeMetadata(output),
2632
- };
2172
+ });
2173
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2633
2174
  }
2634
- const message = response.message || response.Message || errorCode;
2635
- response.message = message;
2636
- delete response.Message;
2637
- return Promise.reject(Object.assign(new Error(message), response));
2638
2175
  };
2639
2176
  const deserializeAws_restJson1GetBackendEnvironmentCommand = async (output, context) => {
2640
2177
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2662,51 +2199,25 @@ const deserializeAws_restJson1GetBackendEnvironmentCommandError = async (output,
2662
2199
  switch (errorCode) {
2663
2200
  case "BadRequestException":
2664
2201
  case "com.amazonaws.amplify#BadRequestException":
2665
- response = {
2666
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2667
- name: errorCode,
2668
- $metadata: deserializeMetadata(output),
2669
- };
2670
- break;
2202
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2671
2203
  case "InternalFailureException":
2672
2204
  case "com.amazonaws.amplify#InternalFailureException":
2673
- response = {
2674
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2675
- name: errorCode,
2676
- $metadata: deserializeMetadata(output),
2677
- };
2678
- break;
2205
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2679
2206
  case "NotFoundException":
2680
2207
  case "com.amazonaws.amplify#NotFoundException":
2681
- response = {
2682
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2683
- name: errorCode,
2684
- $metadata: deserializeMetadata(output),
2685
- };
2686
- break;
2208
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2687
2209
  case "UnauthorizedException":
2688
2210
  case "com.amazonaws.amplify#UnauthorizedException":
2689
- response = {
2690
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2691
- name: errorCode,
2692
- $metadata: deserializeMetadata(output),
2693
- };
2694
- break;
2211
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2695
2212
  default:
2696
2213
  const parsedBody = parsedOutput.body;
2697
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2698
- response = {
2699
- ...parsedBody,
2700
- name: `${errorCode}`,
2701
- message: parsedBody.message || parsedBody.Message || errorCode,
2214
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2215
+ name: parsedBody.code || parsedBody.Code || errorCode,
2702
2216
  $fault: "client",
2703
2217
  $metadata: deserializeMetadata(output),
2704
- };
2218
+ });
2219
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2705
2220
  }
2706
- const message = response.message || response.Message || errorCode;
2707
- response.message = message;
2708
- delete response.Message;
2709
- return Promise.reject(Object.assign(new Error(message), response));
2710
2221
  };
2711
2222
  const deserializeAws_restJson1GetBranchCommand = async (output, context) => {
2712
2223
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2734,51 +2245,25 @@ const deserializeAws_restJson1GetBranchCommandError = async (output, context) =>
2734
2245
  switch (errorCode) {
2735
2246
  case "BadRequestException":
2736
2247
  case "com.amazonaws.amplify#BadRequestException":
2737
- response = {
2738
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2739
- name: errorCode,
2740
- $metadata: deserializeMetadata(output),
2741
- };
2742
- break;
2248
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2743
2249
  case "InternalFailureException":
2744
2250
  case "com.amazonaws.amplify#InternalFailureException":
2745
- response = {
2746
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2747
- name: errorCode,
2748
- $metadata: deserializeMetadata(output),
2749
- };
2750
- break;
2251
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2751
2252
  case "NotFoundException":
2752
2253
  case "com.amazonaws.amplify#NotFoundException":
2753
- response = {
2754
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2755
- name: errorCode,
2756
- $metadata: deserializeMetadata(output),
2757
- };
2758
- break;
2254
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2759
2255
  case "UnauthorizedException":
2760
2256
  case "com.amazonaws.amplify#UnauthorizedException":
2761
- response = {
2762
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2763
- name: errorCode,
2764
- $metadata: deserializeMetadata(output),
2765
- };
2766
- break;
2257
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2767
2258
  default:
2768
2259
  const parsedBody = parsedOutput.body;
2769
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2770
- response = {
2771
- ...parsedBody,
2772
- name: `${errorCode}`,
2773
- message: parsedBody.message || parsedBody.Message || errorCode,
2260
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2261
+ name: parsedBody.code || parsedBody.Code || errorCode,
2774
2262
  $fault: "client",
2775
2263
  $metadata: deserializeMetadata(output),
2776
- };
2264
+ });
2265
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2777
2266
  }
2778
- const message = response.message || response.Message || errorCode;
2779
- response.message = message;
2780
- delete response.Message;
2781
- return Promise.reject(Object.assign(new Error(message), response));
2782
2267
  };
2783
2268
  const deserializeAws_restJson1GetDomainAssociationCommand = async (output, context) => {
2784
2269
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2806,51 +2291,25 @@ const deserializeAws_restJson1GetDomainAssociationCommandError = async (output,
2806
2291
  switch (errorCode) {
2807
2292
  case "BadRequestException":
2808
2293
  case "com.amazonaws.amplify#BadRequestException":
2809
- response = {
2810
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2811
- name: errorCode,
2812
- $metadata: deserializeMetadata(output),
2813
- };
2814
- break;
2294
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2815
2295
  case "InternalFailureException":
2816
2296
  case "com.amazonaws.amplify#InternalFailureException":
2817
- response = {
2818
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2819
- name: errorCode,
2820
- $metadata: deserializeMetadata(output),
2821
- };
2822
- break;
2297
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2823
2298
  case "NotFoundException":
2824
2299
  case "com.amazonaws.amplify#NotFoundException":
2825
- response = {
2826
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2827
- name: errorCode,
2828
- $metadata: deserializeMetadata(output),
2829
- };
2830
- break;
2300
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2831
2301
  case "UnauthorizedException":
2832
2302
  case "com.amazonaws.amplify#UnauthorizedException":
2833
- response = {
2834
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2835
- name: errorCode,
2836
- $metadata: deserializeMetadata(output),
2837
- };
2838
- break;
2303
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2839
2304
  default:
2840
2305
  const parsedBody = parsedOutput.body;
2841
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2842
- response = {
2843
- ...parsedBody,
2844
- name: `${errorCode}`,
2845
- message: parsedBody.message || parsedBody.Message || errorCode,
2306
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2307
+ name: parsedBody.code || parsedBody.Code || errorCode,
2846
2308
  $fault: "client",
2847
2309
  $metadata: deserializeMetadata(output),
2848
- };
2310
+ });
2311
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2849
2312
  }
2850
- const message = response.message || response.Message || errorCode;
2851
- response.message = message;
2852
- delete response.Message;
2853
- return Promise.reject(Object.assign(new Error(message), response));
2854
2313
  };
2855
2314
  const deserializeAws_restJson1GetJobCommand = async (output, context) => {
2856
2315
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2878,59 +2337,28 @@ const deserializeAws_restJson1GetJobCommandError = async (output, context) => {
2878
2337
  switch (errorCode) {
2879
2338
  case "BadRequestException":
2880
2339
  case "com.amazonaws.amplify#BadRequestException":
2881
- response = {
2882
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2883
- name: errorCode,
2884
- $metadata: deserializeMetadata(output),
2885
- };
2886
- break;
2340
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2887
2341
  case "InternalFailureException":
2888
2342
  case "com.amazonaws.amplify#InternalFailureException":
2889
- response = {
2890
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2891
- name: errorCode,
2892
- $metadata: deserializeMetadata(output),
2893
- };
2894
- break;
2343
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2895
2344
  case "LimitExceededException":
2896
2345
  case "com.amazonaws.amplify#LimitExceededException":
2897
- response = {
2898
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2899
- name: errorCode,
2900
- $metadata: deserializeMetadata(output),
2901
- };
2902
- break;
2346
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2903
2347
  case "NotFoundException":
2904
2348
  case "com.amazonaws.amplify#NotFoundException":
2905
- response = {
2906
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2907
- name: errorCode,
2908
- $metadata: deserializeMetadata(output),
2909
- };
2910
- break;
2349
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2911
2350
  case "UnauthorizedException":
2912
2351
  case "com.amazonaws.amplify#UnauthorizedException":
2913
- response = {
2914
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2915
- name: errorCode,
2916
- $metadata: deserializeMetadata(output),
2917
- };
2918
- break;
2352
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2919
2353
  default:
2920
2354
  const parsedBody = parsedOutput.body;
2921
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2922
- response = {
2923
- ...parsedBody,
2924
- name: `${errorCode}`,
2925
- message: parsedBody.message || parsedBody.Message || errorCode,
2355
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2356
+ name: parsedBody.code || parsedBody.Code || errorCode,
2926
2357
  $fault: "client",
2927
2358
  $metadata: deserializeMetadata(output),
2928
- };
2359
+ });
2360
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2929
2361
  }
2930
- const message = response.message || response.Message || errorCode;
2931
- response.message = message;
2932
- delete response.Message;
2933
- return Promise.reject(Object.assign(new Error(message), response));
2934
2362
  };
2935
2363
  const deserializeAws_restJson1GetWebhookCommand = async (output, context) => {
2936
2364
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2958,59 +2386,28 @@ const deserializeAws_restJson1GetWebhookCommandError = async (output, context) =
2958
2386
  switch (errorCode) {
2959
2387
  case "BadRequestException":
2960
2388
  case "com.amazonaws.amplify#BadRequestException":
2961
- response = {
2962
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
2963
- name: errorCode,
2964
- $metadata: deserializeMetadata(output),
2965
- };
2966
- break;
2389
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
2967
2390
  case "InternalFailureException":
2968
2391
  case "com.amazonaws.amplify#InternalFailureException":
2969
- response = {
2970
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
2971
- name: errorCode,
2972
- $metadata: deserializeMetadata(output),
2973
- };
2974
- break;
2392
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
2975
2393
  case "LimitExceededException":
2976
2394
  case "com.amazonaws.amplify#LimitExceededException":
2977
- response = {
2978
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
2979
- name: errorCode,
2980
- $metadata: deserializeMetadata(output),
2981
- };
2982
- break;
2395
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
2983
2396
  case "NotFoundException":
2984
2397
  case "com.amazonaws.amplify#NotFoundException":
2985
- response = {
2986
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
2987
- name: errorCode,
2988
- $metadata: deserializeMetadata(output),
2989
- };
2990
- break;
2398
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
2991
2399
  case "UnauthorizedException":
2992
2400
  case "com.amazonaws.amplify#UnauthorizedException":
2993
- response = {
2994
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
2995
- name: errorCode,
2996
- $metadata: deserializeMetadata(output),
2997
- };
2998
- break;
2401
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
2999
2402
  default:
3000
2403
  const parsedBody = parsedOutput.body;
3001
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3002
- response = {
3003
- ...parsedBody,
3004
- name: `${errorCode}`,
3005
- message: parsedBody.message || parsedBody.Message || errorCode,
2404
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2405
+ name: parsedBody.code || parsedBody.Code || errorCode,
3006
2406
  $fault: "client",
3007
2407
  $metadata: deserializeMetadata(output),
3008
- };
2408
+ });
2409
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3009
2410
  }
3010
- const message = response.message || response.Message || errorCode;
3011
- response.message = message;
3012
- delete response.Message;
3013
- return Promise.reject(Object.assign(new Error(message), response));
3014
2411
  };
3015
2412
  const deserializeAws_restJson1ListAppsCommand = async (output, context) => {
3016
2413
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3042,43 +2439,22 @@ const deserializeAws_restJson1ListAppsCommandError = async (output, context) =>
3042
2439
  switch (errorCode) {
3043
2440
  case "BadRequestException":
3044
2441
  case "com.amazonaws.amplify#BadRequestException":
3045
- response = {
3046
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3047
- name: errorCode,
3048
- $metadata: deserializeMetadata(output),
3049
- };
3050
- break;
2442
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3051
2443
  case "InternalFailureException":
3052
2444
  case "com.amazonaws.amplify#InternalFailureException":
3053
- response = {
3054
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3055
- name: errorCode,
3056
- $metadata: deserializeMetadata(output),
3057
- };
3058
- break;
2445
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3059
2446
  case "UnauthorizedException":
3060
2447
  case "com.amazonaws.amplify#UnauthorizedException":
3061
- response = {
3062
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3063
- name: errorCode,
3064
- $metadata: deserializeMetadata(output),
3065
- };
3066
- break;
2448
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3067
2449
  default:
3068
2450
  const parsedBody = parsedOutput.body;
3069
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3070
- response = {
3071
- ...parsedBody,
3072
- name: `${errorCode}`,
3073
- message: parsedBody.message || parsedBody.Message || errorCode,
2451
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2452
+ name: parsedBody.code || parsedBody.Code || errorCode,
3074
2453
  $fault: "client",
3075
2454
  $metadata: deserializeMetadata(output),
3076
- };
2455
+ });
2456
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3077
2457
  }
3078
- const message = response.message || response.Message || errorCode;
3079
- response.message = message;
3080
- delete response.Message;
3081
- return Promise.reject(Object.assign(new Error(message), response));
3082
2458
  };
3083
2459
  const deserializeAws_restJson1ListArtifactsCommand = async (output, context) => {
3084
2460
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3110,51 +2486,25 @@ const deserializeAws_restJson1ListArtifactsCommandError = async (output, context
3110
2486
  switch (errorCode) {
3111
2487
  case "BadRequestException":
3112
2488
  case "com.amazonaws.amplify#BadRequestException":
3113
- response = {
3114
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3115
- name: errorCode,
3116
- $metadata: deserializeMetadata(output),
3117
- };
3118
- break;
2489
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3119
2490
  case "InternalFailureException":
3120
2491
  case "com.amazonaws.amplify#InternalFailureException":
3121
- response = {
3122
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3123
- name: errorCode,
3124
- $metadata: deserializeMetadata(output),
3125
- };
3126
- break;
2492
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3127
2493
  case "LimitExceededException":
3128
2494
  case "com.amazonaws.amplify#LimitExceededException":
3129
- response = {
3130
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3131
- name: errorCode,
3132
- $metadata: deserializeMetadata(output),
3133
- };
3134
- break;
2495
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3135
2496
  case "UnauthorizedException":
3136
2497
  case "com.amazonaws.amplify#UnauthorizedException":
3137
- response = {
3138
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3139
- name: errorCode,
3140
- $metadata: deserializeMetadata(output),
3141
- };
3142
- break;
2498
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3143
2499
  default:
3144
2500
  const parsedBody = parsedOutput.body;
3145
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3146
- response = {
3147
- ...parsedBody,
3148
- name: `${errorCode}`,
3149
- message: parsedBody.message || parsedBody.Message || errorCode,
2501
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2502
+ name: parsedBody.code || parsedBody.Code || errorCode,
3150
2503
  $fault: "client",
3151
2504
  $metadata: deserializeMetadata(output),
3152
- };
2505
+ });
2506
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3153
2507
  }
3154
- const message = response.message || response.Message || errorCode;
3155
- response.message = message;
3156
- delete response.Message;
3157
- return Promise.reject(Object.assign(new Error(message), response));
3158
2508
  };
3159
2509
  const deserializeAws_restJson1ListBackendEnvironmentsCommand = async (output, context) => {
3160
2510
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3186,43 +2536,22 @@ const deserializeAws_restJson1ListBackendEnvironmentsCommandError = async (outpu
3186
2536
  switch (errorCode) {
3187
2537
  case "BadRequestException":
3188
2538
  case "com.amazonaws.amplify#BadRequestException":
3189
- response = {
3190
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3191
- name: errorCode,
3192
- $metadata: deserializeMetadata(output),
3193
- };
3194
- break;
2539
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3195
2540
  case "InternalFailureException":
3196
2541
  case "com.amazonaws.amplify#InternalFailureException":
3197
- response = {
3198
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3199
- name: errorCode,
3200
- $metadata: deserializeMetadata(output),
3201
- };
3202
- break;
2542
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3203
2543
  case "UnauthorizedException":
3204
2544
  case "com.amazonaws.amplify#UnauthorizedException":
3205
- response = {
3206
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3207
- name: errorCode,
3208
- $metadata: deserializeMetadata(output),
3209
- };
3210
- break;
2545
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3211
2546
  default:
3212
2547
  const parsedBody = parsedOutput.body;
3213
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3214
- response = {
3215
- ...parsedBody,
3216
- name: `${errorCode}`,
3217
- message: parsedBody.message || parsedBody.Message || errorCode,
2548
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2549
+ name: parsedBody.code || parsedBody.Code || errorCode,
3218
2550
  $fault: "client",
3219
2551
  $metadata: deserializeMetadata(output),
3220
- };
2552
+ });
2553
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3221
2554
  }
3222
- const message = response.message || response.Message || errorCode;
3223
- response.message = message;
3224
- delete response.Message;
3225
- return Promise.reject(Object.assign(new Error(message), response));
3226
2555
  };
3227
2556
  const deserializeAws_restJson1ListBranchesCommand = async (output, context) => {
3228
2557
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3254,43 +2583,22 @@ const deserializeAws_restJson1ListBranchesCommandError = async (output, context)
3254
2583
  switch (errorCode) {
3255
2584
  case "BadRequestException":
3256
2585
  case "com.amazonaws.amplify#BadRequestException":
3257
- response = {
3258
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3259
- name: errorCode,
3260
- $metadata: deserializeMetadata(output),
3261
- };
3262
- break;
2586
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3263
2587
  case "InternalFailureException":
3264
2588
  case "com.amazonaws.amplify#InternalFailureException":
3265
- response = {
3266
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3267
- name: errorCode,
3268
- $metadata: deserializeMetadata(output),
3269
- };
3270
- break;
2589
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3271
2590
  case "UnauthorizedException":
3272
2591
  case "com.amazonaws.amplify#UnauthorizedException":
3273
- response = {
3274
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3275
- name: errorCode,
3276
- $metadata: deserializeMetadata(output),
3277
- };
3278
- break;
2592
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3279
2593
  default:
3280
2594
  const parsedBody = parsedOutput.body;
3281
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3282
- response = {
3283
- ...parsedBody,
3284
- name: `${errorCode}`,
3285
- message: parsedBody.message || parsedBody.Message || errorCode,
2595
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2596
+ name: parsedBody.code || parsedBody.Code || errorCode,
3286
2597
  $fault: "client",
3287
2598
  $metadata: deserializeMetadata(output),
3288
- };
2599
+ });
2600
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3289
2601
  }
3290
- const message = response.message || response.Message || errorCode;
3291
- response.message = message;
3292
- delete response.Message;
3293
- return Promise.reject(Object.assign(new Error(message), response));
3294
2602
  };
3295
2603
  const deserializeAws_restJson1ListDomainAssociationsCommand = async (output, context) => {
3296
2604
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3322,43 +2630,22 @@ const deserializeAws_restJson1ListDomainAssociationsCommandError = async (output
3322
2630
  switch (errorCode) {
3323
2631
  case "BadRequestException":
3324
2632
  case "com.amazonaws.amplify#BadRequestException":
3325
- response = {
3326
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3327
- name: errorCode,
3328
- $metadata: deserializeMetadata(output),
3329
- };
3330
- break;
2633
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3331
2634
  case "InternalFailureException":
3332
2635
  case "com.amazonaws.amplify#InternalFailureException":
3333
- response = {
3334
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3335
- name: errorCode,
3336
- $metadata: deserializeMetadata(output),
3337
- };
3338
- break;
2636
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3339
2637
  case "UnauthorizedException":
3340
2638
  case "com.amazonaws.amplify#UnauthorizedException":
3341
- response = {
3342
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3343
- name: errorCode,
3344
- $metadata: deserializeMetadata(output),
3345
- };
3346
- break;
2639
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3347
2640
  default:
3348
2641
  const parsedBody = parsedOutput.body;
3349
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3350
- response = {
3351
- ...parsedBody,
3352
- name: `${errorCode}`,
3353
- message: parsedBody.message || parsedBody.Message || errorCode,
2642
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2643
+ name: parsedBody.code || parsedBody.Code || errorCode,
3354
2644
  $fault: "client",
3355
2645
  $metadata: deserializeMetadata(output),
3356
- };
2646
+ });
2647
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3357
2648
  }
3358
- const message = response.message || response.Message || errorCode;
3359
- response.message = message;
3360
- delete response.Message;
3361
- return Promise.reject(Object.assign(new Error(message), response));
3362
2649
  };
3363
2650
  const deserializeAws_restJson1ListJobsCommand = async (output, context) => {
3364
2651
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3390,51 +2677,25 @@ const deserializeAws_restJson1ListJobsCommandError = async (output, context) =>
3390
2677
  switch (errorCode) {
3391
2678
  case "BadRequestException":
3392
2679
  case "com.amazonaws.amplify#BadRequestException":
3393
- response = {
3394
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3395
- name: errorCode,
3396
- $metadata: deserializeMetadata(output),
3397
- };
3398
- break;
2680
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3399
2681
  case "InternalFailureException":
3400
2682
  case "com.amazonaws.amplify#InternalFailureException":
3401
- response = {
3402
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3403
- name: errorCode,
3404
- $metadata: deserializeMetadata(output),
3405
- };
3406
- break;
2683
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3407
2684
  case "LimitExceededException":
3408
2685
  case "com.amazonaws.amplify#LimitExceededException":
3409
- response = {
3410
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3411
- name: errorCode,
3412
- $metadata: deserializeMetadata(output),
3413
- };
3414
- break;
2686
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3415
2687
  case "UnauthorizedException":
3416
2688
  case "com.amazonaws.amplify#UnauthorizedException":
3417
- response = {
3418
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3419
- name: errorCode,
3420
- $metadata: deserializeMetadata(output),
3421
- };
3422
- break;
2689
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3423
2690
  default:
3424
2691
  const parsedBody = parsedOutput.body;
3425
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3426
- response = {
3427
- ...parsedBody,
3428
- name: `${errorCode}`,
3429
- message: parsedBody.message || parsedBody.Message || errorCode,
2692
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2693
+ name: parsedBody.code || parsedBody.Code || errorCode,
3430
2694
  $fault: "client",
3431
2695
  $metadata: deserializeMetadata(output),
3432
- };
2696
+ });
2697
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3433
2698
  }
3434
- const message = response.message || response.Message || errorCode;
3435
- response.message = message;
3436
- delete response.Message;
3437
- return Promise.reject(Object.assign(new Error(message), response));
3438
2699
  };
3439
2700
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
3440
2701
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3462,43 +2723,22 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
3462
2723
  switch (errorCode) {
3463
2724
  case "BadRequestException":
3464
2725
  case "com.amazonaws.amplify#BadRequestException":
3465
- response = {
3466
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3467
- name: errorCode,
3468
- $metadata: deserializeMetadata(output),
3469
- };
3470
- break;
2726
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3471
2727
  case "InternalFailureException":
3472
2728
  case "com.amazonaws.amplify#InternalFailureException":
3473
- response = {
3474
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3475
- name: errorCode,
3476
- $metadata: deserializeMetadata(output),
3477
- };
3478
- break;
2729
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3479
2730
  case "ResourceNotFoundException":
3480
2731
  case "com.amazonaws.amplify#ResourceNotFoundException":
3481
- response = {
3482
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3483
- name: errorCode,
3484
- $metadata: deserializeMetadata(output),
3485
- };
3486
- break;
2732
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
3487
2733
  default:
3488
2734
  const parsedBody = parsedOutput.body;
3489
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3490
- response = {
3491
- ...parsedBody,
3492
- name: `${errorCode}`,
3493
- message: parsedBody.message || parsedBody.Message || errorCode,
2735
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2736
+ name: parsedBody.code || parsedBody.Code || errorCode,
3494
2737
  $fault: "client",
3495
2738
  $metadata: deserializeMetadata(output),
3496
- };
2739
+ });
2740
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3497
2741
  }
3498
- const message = response.message || response.Message || errorCode;
3499
- response.message = message;
3500
- delete response.Message;
3501
- return Promise.reject(Object.assign(new Error(message), response));
3502
2742
  };
3503
2743
  const deserializeAws_restJson1ListWebhooksCommand = async (output, context) => {
3504
2744
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3530,51 +2770,25 @@ const deserializeAws_restJson1ListWebhooksCommandError = async (output, context)
3530
2770
  switch (errorCode) {
3531
2771
  case "BadRequestException":
3532
2772
  case "com.amazonaws.amplify#BadRequestException":
3533
- response = {
3534
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3535
- name: errorCode,
3536
- $metadata: deserializeMetadata(output),
3537
- };
3538
- break;
2773
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3539
2774
  case "InternalFailureException":
3540
2775
  case "com.amazonaws.amplify#InternalFailureException":
3541
- response = {
3542
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3543
- name: errorCode,
3544
- $metadata: deserializeMetadata(output),
3545
- };
3546
- break;
2776
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3547
2777
  case "LimitExceededException":
3548
2778
  case "com.amazonaws.amplify#LimitExceededException":
3549
- response = {
3550
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3551
- name: errorCode,
3552
- $metadata: deserializeMetadata(output),
3553
- };
3554
- break;
2779
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3555
2780
  case "UnauthorizedException":
3556
2781
  case "com.amazonaws.amplify#UnauthorizedException":
3557
- response = {
3558
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3559
- name: errorCode,
3560
- $metadata: deserializeMetadata(output),
3561
- };
3562
- break;
2782
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3563
2783
  default:
3564
2784
  const parsedBody = parsedOutput.body;
3565
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3566
- response = {
3567
- ...parsedBody,
3568
- name: `${errorCode}`,
3569
- message: parsedBody.message || parsedBody.Message || errorCode,
2785
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2786
+ name: parsedBody.code || parsedBody.Code || errorCode,
3570
2787
  $fault: "client",
3571
2788
  $metadata: deserializeMetadata(output),
3572
- };
2789
+ });
2790
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3573
2791
  }
3574
- const message = response.message || response.Message || errorCode;
3575
- response.message = message;
3576
- delete response.Message;
3577
- return Promise.reject(Object.assign(new Error(message), response));
3578
2792
  };
3579
2793
  const deserializeAws_restJson1StartDeploymentCommand = async (output, context) => {
3580
2794
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3602,59 +2816,28 @@ const deserializeAws_restJson1StartDeploymentCommandError = async (output, conte
3602
2816
  switch (errorCode) {
3603
2817
  case "BadRequestException":
3604
2818
  case "com.amazonaws.amplify#BadRequestException":
3605
- response = {
3606
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3607
- name: errorCode,
3608
- $metadata: deserializeMetadata(output),
3609
- };
3610
- break;
2819
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3611
2820
  case "InternalFailureException":
3612
2821
  case "com.amazonaws.amplify#InternalFailureException":
3613
- response = {
3614
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3615
- name: errorCode,
3616
- $metadata: deserializeMetadata(output),
3617
- };
3618
- break;
2822
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3619
2823
  case "LimitExceededException":
3620
2824
  case "com.amazonaws.amplify#LimitExceededException":
3621
- response = {
3622
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3623
- name: errorCode,
3624
- $metadata: deserializeMetadata(output),
3625
- };
3626
- break;
2825
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3627
2826
  case "NotFoundException":
3628
2827
  case "com.amazonaws.amplify#NotFoundException":
3629
- response = {
3630
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3631
- name: errorCode,
3632
- $metadata: deserializeMetadata(output),
3633
- };
3634
- break;
2828
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3635
2829
  case "UnauthorizedException":
3636
2830
  case "com.amazonaws.amplify#UnauthorizedException":
3637
- response = {
3638
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3639
- name: errorCode,
3640
- $metadata: deserializeMetadata(output),
3641
- };
3642
- break;
2831
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3643
2832
  default:
3644
2833
  const parsedBody = parsedOutput.body;
3645
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3646
- response = {
3647
- ...parsedBody,
3648
- name: `${errorCode}`,
3649
- message: parsedBody.message || parsedBody.Message || errorCode,
2834
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2835
+ name: parsedBody.code || parsedBody.Code || errorCode,
3650
2836
  $fault: "client",
3651
2837
  $metadata: deserializeMetadata(output),
3652
- };
2838
+ });
2839
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3653
2840
  }
3654
- const message = response.message || response.Message || errorCode;
3655
- response.message = message;
3656
- delete response.Message;
3657
- return Promise.reject(Object.assign(new Error(message), response));
3658
2841
  };
3659
2842
  const deserializeAws_restJson1StartJobCommand = async (output, context) => {
3660
2843
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3682,59 +2865,28 @@ const deserializeAws_restJson1StartJobCommandError = async (output, context) =>
3682
2865
  switch (errorCode) {
3683
2866
  case "BadRequestException":
3684
2867
  case "com.amazonaws.amplify#BadRequestException":
3685
- response = {
3686
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3687
- name: errorCode,
3688
- $metadata: deserializeMetadata(output),
3689
- };
3690
- break;
2868
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3691
2869
  case "InternalFailureException":
3692
2870
  case "com.amazonaws.amplify#InternalFailureException":
3693
- response = {
3694
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3695
- name: errorCode,
3696
- $metadata: deserializeMetadata(output),
3697
- };
3698
- break;
2871
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3699
2872
  case "LimitExceededException":
3700
2873
  case "com.amazonaws.amplify#LimitExceededException":
3701
- response = {
3702
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3703
- name: errorCode,
3704
- $metadata: deserializeMetadata(output),
3705
- };
3706
- break;
2874
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3707
2875
  case "NotFoundException":
3708
2876
  case "com.amazonaws.amplify#NotFoundException":
3709
- response = {
3710
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3711
- name: errorCode,
3712
- $metadata: deserializeMetadata(output),
3713
- };
3714
- break;
2877
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3715
2878
  case "UnauthorizedException":
3716
2879
  case "com.amazonaws.amplify#UnauthorizedException":
3717
- response = {
3718
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3719
- name: errorCode,
3720
- $metadata: deserializeMetadata(output),
3721
- };
3722
- break;
2880
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3723
2881
  default:
3724
2882
  const parsedBody = parsedOutput.body;
3725
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3726
- response = {
3727
- ...parsedBody,
3728
- name: `${errorCode}`,
3729
- message: parsedBody.message || parsedBody.Message || errorCode,
2883
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2884
+ name: parsedBody.code || parsedBody.Code || errorCode,
3730
2885
  $fault: "client",
3731
2886
  $metadata: deserializeMetadata(output),
3732
- };
2887
+ });
2888
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3733
2889
  }
3734
- const message = response.message || response.Message || errorCode;
3735
- response.message = message;
3736
- delete response.Message;
3737
- return Promise.reject(Object.assign(new Error(message), response));
3738
2890
  };
3739
2891
  const deserializeAws_restJson1StopJobCommand = async (output, context) => {
3740
2892
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3762,59 +2914,28 @@ const deserializeAws_restJson1StopJobCommandError = async (output, context) => {
3762
2914
  switch (errorCode) {
3763
2915
  case "BadRequestException":
3764
2916
  case "com.amazonaws.amplify#BadRequestException":
3765
- response = {
3766
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3767
- name: errorCode,
3768
- $metadata: deserializeMetadata(output),
3769
- };
3770
- break;
2917
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3771
2918
  case "InternalFailureException":
3772
2919
  case "com.amazonaws.amplify#InternalFailureException":
3773
- response = {
3774
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3775
- name: errorCode,
3776
- $metadata: deserializeMetadata(output),
3777
- };
3778
- break;
2920
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3779
2921
  case "LimitExceededException":
3780
2922
  case "com.amazonaws.amplify#LimitExceededException":
3781
- response = {
3782
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
3783
- name: errorCode,
3784
- $metadata: deserializeMetadata(output),
3785
- };
3786
- break;
2923
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
3787
2924
  case "NotFoundException":
3788
2925
  case "com.amazonaws.amplify#NotFoundException":
3789
- response = {
3790
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3791
- name: errorCode,
3792
- $metadata: deserializeMetadata(output),
3793
- };
3794
- break;
2926
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3795
2927
  case "UnauthorizedException":
3796
2928
  case "com.amazonaws.amplify#UnauthorizedException":
3797
- response = {
3798
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3799
- name: errorCode,
3800
- $metadata: deserializeMetadata(output),
3801
- };
3802
- break;
2929
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3803
2930
  default:
3804
2931
  const parsedBody = parsedOutput.body;
3805
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3806
- response = {
3807
- ...parsedBody,
3808
- name: `${errorCode}`,
3809
- message: parsedBody.message || parsedBody.Message || errorCode,
2932
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2933
+ name: parsedBody.code || parsedBody.Code || errorCode,
3810
2934
  $fault: "client",
3811
2935
  $metadata: deserializeMetadata(output),
3812
- };
2936
+ });
2937
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3813
2938
  }
3814
- const message = response.message || response.Message || errorCode;
3815
- response.message = message;
3816
- delete response.Message;
3817
- return Promise.reject(Object.assign(new Error(message), response));
3818
2939
  };
3819
2940
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
3820
2941
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3838,43 +2959,22 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
3838
2959
  switch (errorCode) {
3839
2960
  case "BadRequestException":
3840
2961
  case "com.amazonaws.amplify#BadRequestException":
3841
- response = {
3842
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3843
- name: errorCode,
3844
- $metadata: deserializeMetadata(output),
3845
- };
3846
- break;
2962
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3847
2963
  case "InternalFailureException":
3848
2964
  case "com.amazonaws.amplify#InternalFailureException":
3849
- response = {
3850
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3851
- name: errorCode,
3852
- $metadata: deserializeMetadata(output),
3853
- };
3854
- break;
2965
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3855
2966
  case "ResourceNotFoundException":
3856
2967
  case "com.amazonaws.amplify#ResourceNotFoundException":
3857
- response = {
3858
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3859
- name: errorCode,
3860
- $metadata: deserializeMetadata(output),
3861
- };
3862
- break;
2968
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
3863
2969
  default:
3864
2970
  const parsedBody = parsedOutput.body;
3865
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3866
- response = {
3867
- ...parsedBody,
3868
- name: `${errorCode}`,
3869
- message: parsedBody.message || parsedBody.Message || errorCode,
2971
+ response = new AmplifyServiceException_1.AmplifyServiceException({
2972
+ name: parsedBody.code || parsedBody.Code || errorCode,
3870
2973
  $fault: "client",
3871
2974
  $metadata: deserializeMetadata(output),
3872
- };
2975
+ });
2976
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3873
2977
  }
3874
- const message = response.message || response.Message || errorCode;
3875
- response.message = message;
3876
- delete response.Message;
3877
- return Promise.reject(Object.assign(new Error(message), response));
3878
2978
  };
3879
2979
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
3880
2980
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3898,43 +2998,22 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
3898
2998
  switch (errorCode) {
3899
2999
  case "BadRequestException":
3900
3000
  case "com.amazonaws.amplify#BadRequestException":
3901
- response = {
3902
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3903
- name: errorCode,
3904
- $metadata: deserializeMetadata(output),
3905
- };
3906
- break;
3001
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3907
3002
  case "InternalFailureException":
3908
3003
  case "com.amazonaws.amplify#InternalFailureException":
3909
- response = {
3910
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3911
- name: errorCode,
3912
- $metadata: deserializeMetadata(output),
3913
- };
3914
- break;
3004
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3915
3005
  case "ResourceNotFoundException":
3916
3006
  case "com.amazonaws.amplify#ResourceNotFoundException":
3917
- response = {
3918
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3919
- name: errorCode,
3920
- $metadata: deserializeMetadata(output),
3921
- };
3922
- break;
3007
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
3923
3008
  default:
3924
3009
  const parsedBody = parsedOutput.body;
3925
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3926
- response = {
3927
- ...parsedBody,
3928
- name: `${errorCode}`,
3929
- message: parsedBody.message || parsedBody.Message || errorCode,
3010
+ response = new AmplifyServiceException_1.AmplifyServiceException({
3011
+ name: parsedBody.code || parsedBody.Code || errorCode,
3930
3012
  $fault: "client",
3931
3013
  $metadata: deserializeMetadata(output),
3932
- };
3014
+ });
3015
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3933
3016
  }
3934
- const message = response.message || response.Message || errorCode;
3935
- response.message = message;
3936
- delete response.Message;
3937
- return Promise.reject(Object.assign(new Error(message), response));
3938
3017
  };
3939
3018
  const deserializeAws_restJson1UpdateAppCommand = async (output, context) => {
3940
3019
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -3962,51 +3041,25 @@ const deserializeAws_restJson1UpdateAppCommandError = async (output, context) =>
3962
3041
  switch (errorCode) {
3963
3042
  case "BadRequestException":
3964
3043
  case "com.amazonaws.amplify#BadRequestException":
3965
- response = {
3966
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
3967
- name: errorCode,
3968
- $metadata: deserializeMetadata(output),
3969
- };
3970
- break;
3044
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
3971
3045
  case "InternalFailureException":
3972
3046
  case "com.amazonaws.amplify#InternalFailureException":
3973
- response = {
3974
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
3975
- name: errorCode,
3976
- $metadata: deserializeMetadata(output),
3977
- };
3978
- break;
3047
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
3979
3048
  case "NotFoundException":
3980
3049
  case "com.amazonaws.amplify#NotFoundException":
3981
- response = {
3982
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
3983
- name: errorCode,
3984
- $metadata: deserializeMetadata(output),
3985
- };
3986
- break;
3050
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
3987
3051
  case "UnauthorizedException":
3988
3052
  case "com.amazonaws.amplify#UnauthorizedException":
3989
- response = {
3990
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
3991
- name: errorCode,
3992
- $metadata: deserializeMetadata(output),
3993
- };
3994
- break;
3053
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
3995
3054
  default:
3996
3055
  const parsedBody = parsedOutput.body;
3997
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3998
- response = {
3999
- ...parsedBody,
4000
- name: `${errorCode}`,
4001
- message: parsedBody.message || parsedBody.Message || errorCode,
3056
+ response = new AmplifyServiceException_1.AmplifyServiceException({
3057
+ name: parsedBody.code || parsedBody.Code || errorCode,
4002
3058
  $fault: "client",
4003
3059
  $metadata: deserializeMetadata(output),
4004
- };
3060
+ });
3061
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
4005
3062
  }
4006
- const message = response.message || response.Message || errorCode;
4007
- response.message = message;
4008
- delete response.Message;
4009
- return Promise.reject(Object.assign(new Error(message), response));
4010
3063
  };
4011
3064
  const deserializeAws_restJson1UpdateBranchCommand = async (output, context) => {
4012
3065
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -4034,59 +3087,28 @@ const deserializeAws_restJson1UpdateBranchCommandError = async (output, context)
4034
3087
  switch (errorCode) {
4035
3088
  case "BadRequestException":
4036
3089
  case "com.amazonaws.amplify#BadRequestException":
4037
- response = {
4038
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
4039
- name: errorCode,
4040
- $metadata: deserializeMetadata(output),
4041
- };
4042
- break;
3090
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
4043
3091
  case "DependentServiceFailureException":
4044
3092
  case "com.amazonaws.amplify#DependentServiceFailureException":
4045
- response = {
4046
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
4047
- name: errorCode,
4048
- $metadata: deserializeMetadata(output),
4049
- };
4050
- break;
3093
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
4051
3094
  case "InternalFailureException":
4052
3095
  case "com.amazonaws.amplify#InternalFailureException":
4053
- response = {
4054
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
4055
- name: errorCode,
4056
- $metadata: deserializeMetadata(output),
4057
- };
4058
- break;
3096
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
4059
3097
  case "NotFoundException":
4060
3098
  case "com.amazonaws.amplify#NotFoundException":
4061
- response = {
4062
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
4063
- name: errorCode,
4064
- $metadata: deserializeMetadata(output),
4065
- };
4066
- break;
3099
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
4067
3100
  case "UnauthorizedException":
4068
3101
  case "com.amazonaws.amplify#UnauthorizedException":
4069
- response = {
4070
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
4071
- name: errorCode,
4072
- $metadata: deserializeMetadata(output),
4073
- };
4074
- break;
3102
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4075
3103
  default:
4076
3104
  const parsedBody = parsedOutput.body;
4077
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
4078
- response = {
4079
- ...parsedBody,
4080
- name: `${errorCode}`,
4081
- message: parsedBody.message || parsedBody.Message || errorCode,
3105
+ response = new AmplifyServiceException_1.AmplifyServiceException({
3106
+ name: parsedBody.code || parsedBody.Code || errorCode,
4082
3107
  $fault: "client",
4083
3108
  $metadata: deserializeMetadata(output),
4084
- };
3109
+ });
3110
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
4085
3111
  }
4086
- const message = response.message || response.Message || errorCode;
4087
- response.message = message;
4088
- delete response.Message;
4089
- return Promise.reject(Object.assign(new Error(message), response));
4090
3112
  };
4091
3113
  const deserializeAws_restJson1UpdateDomainAssociationCommand = async (output, context) => {
4092
3114
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -4114,59 +3136,28 @@ const deserializeAws_restJson1UpdateDomainAssociationCommandError = async (outpu
4114
3136
  switch (errorCode) {
4115
3137
  case "BadRequestException":
4116
3138
  case "com.amazonaws.amplify#BadRequestException":
4117
- response = {
4118
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
4119
- name: errorCode,
4120
- $metadata: deserializeMetadata(output),
4121
- };
4122
- break;
3139
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
4123
3140
  case "DependentServiceFailureException":
4124
3141
  case "com.amazonaws.amplify#DependentServiceFailureException":
4125
- response = {
4126
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
4127
- name: errorCode,
4128
- $metadata: deserializeMetadata(output),
4129
- };
4130
- break;
3142
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
4131
3143
  case "InternalFailureException":
4132
3144
  case "com.amazonaws.amplify#InternalFailureException":
4133
- response = {
4134
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
4135
- name: errorCode,
4136
- $metadata: deserializeMetadata(output),
4137
- };
4138
- break;
3145
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
4139
3146
  case "NotFoundException":
4140
3147
  case "com.amazonaws.amplify#NotFoundException":
4141
- response = {
4142
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
4143
- name: errorCode,
4144
- $metadata: deserializeMetadata(output),
4145
- };
4146
- break;
3148
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
4147
3149
  case "UnauthorizedException":
4148
3150
  case "com.amazonaws.amplify#UnauthorizedException":
4149
- response = {
4150
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
4151
- name: errorCode,
4152
- $metadata: deserializeMetadata(output),
4153
- };
4154
- break;
3151
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4155
3152
  default:
4156
3153
  const parsedBody = parsedOutput.body;
4157
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
4158
- response = {
4159
- ...parsedBody,
4160
- name: `${errorCode}`,
4161
- message: parsedBody.message || parsedBody.Message || errorCode,
3154
+ response = new AmplifyServiceException_1.AmplifyServiceException({
3155
+ name: parsedBody.code || parsedBody.Code || errorCode,
4162
3156
  $fault: "client",
4163
3157
  $metadata: deserializeMetadata(output),
4164
- };
3158
+ });
3159
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
4165
3160
  }
4166
- const message = response.message || response.Message || errorCode;
4167
- response.message = message;
4168
- delete response.Message;
4169
- return Promise.reject(Object.assign(new Error(message), response));
4170
3161
  };
4171
3162
  const deserializeAws_restJson1UpdateWebhookCommand = async (output, context) => {
4172
3163
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -4194,133 +3185,91 @@ const deserializeAws_restJson1UpdateWebhookCommandError = async (output, context
4194
3185
  switch (errorCode) {
4195
3186
  case "BadRequestException":
4196
3187
  case "com.amazonaws.amplify#BadRequestException":
4197
- response = {
4198
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
4199
- name: errorCode,
4200
- $metadata: deserializeMetadata(output),
4201
- };
4202
- break;
3188
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
4203
3189
  case "DependentServiceFailureException":
4204
3190
  case "com.amazonaws.amplify#DependentServiceFailureException":
4205
- response = {
4206
- ...(await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context)),
4207
- name: errorCode,
4208
- $metadata: deserializeMetadata(output),
4209
- };
4210
- break;
3191
+ throw await deserializeAws_restJson1DependentServiceFailureExceptionResponse(parsedOutput, context);
4211
3192
  case "InternalFailureException":
4212
3193
  case "com.amazonaws.amplify#InternalFailureException":
4213
- response = {
4214
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
4215
- name: errorCode,
4216
- $metadata: deserializeMetadata(output),
4217
- };
4218
- break;
3194
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
4219
3195
  case "NotFoundException":
4220
3196
  case "com.amazonaws.amplify#NotFoundException":
4221
- response = {
4222
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
4223
- name: errorCode,
4224
- $metadata: deserializeMetadata(output),
4225
- };
4226
- break;
3197
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
4227
3198
  case "UnauthorizedException":
4228
3199
  case "com.amazonaws.amplify#UnauthorizedException":
4229
- response = {
4230
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
4231
- name: errorCode,
4232
- $metadata: deserializeMetadata(output),
4233
- };
4234
- break;
3200
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
4235
3201
  default:
4236
3202
  const parsedBody = parsedOutput.body;
4237
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
4238
- response = {
4239
- ...parsedBody,
4240
- name: `${errorCode}`,
4241
- message: parsedBody.message || parsedBody.Message || errorCode,
3203
+ response = new AmplifyServiceException_1.AmplifyServiceException({
3204
+ name: parsedBody.code || parsedBody.Code || errorCode,
4242
3205
  $fault: "client",
4243
3206
  $metadata: deserializeMetadata(output),
4244
- };
3207
+ });
3208
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
4245
3209
  }
4246
- const message = response.message || response.Message || errorCode;
4247
- response.message = message;
4248
- delete response.Message;
4249
- return Promise.reject(Object.assign(new Error(message), response));
4250
3210
  };
4251
3211
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
4252
- const contents = {
4253
- name: "BadRequestException",
4254
- $fault: "client",
4255
- $metadata: deserializeMetadata(parsedOutput),
4256
- message: undefined,
4257
- };
3212
+ const contents = {};
4258
3213
  const data = parsedOutput.body;
4259
3214
  if (data.message !== undefined && data.message !== null) {
4260
3215
  contents.message = smithy_client_1.expectString(data.message);
4261
3216
  }
4262
- return contents;
3217
+ const exception = new models_0_1.BadRequestException({
3218
+ $metadata: deserializeMetadata(parsedOutput),
3219
+ ...contents,
3220
+ });
3221
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4263
3222
  };
4264
3223
  const deserializeAws_restJson1DependentServiceFailureExceptionResponse = async (parsedOutput, context) => {
4265
- const contents = {
4266
- name: "DependentServiceFailureException",
4267
- $fault: "server",
4268
- $metadata: deserializeMetadata(parsedOutput),
4269
- message: undefined,
4270
- };
3224
+ const contents = {};
4271
3225
  const data = parsedOutput.body;
4272
3226
  if (data.message !== undefined && data.message !== null) {
4273
3227
  contents.message = smithy_client_1.expectString(data.message);
4274
3228
  }
4275
- return contents;
3229
+ const exception = new models_0_1.DependentServiceFailureException({
3230
+ $metadata: deserializeMetadata(parsedOutput),
3231
+ ...contents,
3232
+ });
3233
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4276
3234
  };
4277
3235
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
4278
- const contents = {
4279
- name: "InternalFailureException",
4280
- $fault: "server",
4281
- $metadata: deserializeMetadata(parsedOutput),
4282
- message: undefined,
4283
- };
3236
+ const contents = {};
4284
3237
  const data = parsedOutput.body;
4285
3238
  if (data.message !== undefined && data.message !== null) {
4286
3239
  contents.message = smithy_client_1.expectString(data.message);
4287
3240
  }
4288
- return contents;
3241
+ const exception = new models_0_1.InternalFailureException({
3242
+ $metadata: deserializeMetadata(parsedOutput),
3243
+ ...contents,
3244
+ });
3245
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4289
3246
  };
4290
3247
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
4291
- const contents = {
4292
- name: "LimitExceededException",
4293
- $fault: "client",
4294
- $metadata: deserializeMetadata(parsedOutput),
4295
- message: undefined,
4296
- };
3248
+ const contents = {};
4297
3249
  const data = parsedOutput.body;
4298
3250
  if (data.message !== undefined && data.message !== null) {
4299
3251
  contents.message = smithy_client_1.expectString(data.message);
4300
3252
  }
4301
- return contents;
3253
+ const exception = new models_0_1.LimitExceededException({
3254
+ $metadata: deserializeMetadata(parsedOutput),
3255
+ ...contents,
3256
+ });
3257
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4302
3258
  };
4303
3259
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
4304
- const contents = {
4305
- name: "NotFoundException",
4306
- $fault: "client",
4307
- $metadata: deserializeMetadata(parsedOutput),
4308
- message: undefined,
4309
- };
3260
+ const contents = {};
4310
3261
  const data = parsedOutput.body;
4311
3262
  if (data.message !== undefined && data.message !== null) {
4312
3263
  contents.message = smithy_client_1.expectString(data.message);
4313
3264
  }
4314
- return contents;
3265
+ const exception = new models_0_1.NotFoundException({
3266
+ $metadata: deserializeMetadata(parsedOutput),
3267
+ ...contents,
3268
+ });
3269
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4315
3270
  };
4316
3271
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
4317
- const contents = {
4318
- name: "ResourceNotFoundException",
4319
- $fault: "client",
4320
- $metadata: deserializeMetadata(parsedOutput),
4321
- code: undefined,
4322
- message: undefined,
4323
- };
3272
+ const contents = {};
4324
3273
  const data = parsedOutput.body;
4325
3274
  if (data.code !== undefined && data.code !== null) {
4326
3275
  contents.code = smithy_client_1.expectString(data.code);
@@ -4328,20 +3277,23 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
4328
3277
  if (data.message !== undefined && data.message !== null) {
4329
3278
  contents.message = smithy_client_1.expectString(data.message);
4330
3279
  }
4331
- return contents;
3280
+ const exception = new models_0_1.ResourceNotFoundException({
3281
+ $metadata: deserializeMetadata(parsedOutput),
3282
+ ...contents,
3283
+ });
3284
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4332
3285
  };
4333
3286
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
4334
- const contents = {
4335
- name: "UnauthorizedException",
4336
- $fault: "client",
4337
- $metadata: deserializeMetadata(parsedOutput),
4338
- message: undefined,
4339
- };
3287
+ const contents = {};
4340
3288
  const data = parsedOutput.body;
4341
3289
  if (data.message !== undefined && data.message !== null) {
4342
3290
  contents.message = smithy_client_1.expectString(data.message);
4343
3291
  }
4344
- return contents;
3292
+ const exception = new models_0_1.UnauthorizedException({
3293
+ $metadata: deserializeMetadata(parsedOutput),
3294
+ ...contents,
3295
+ });
3296
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
4345
3297
  };
4346
3298
  const serializeAws_restJson1AutoBranchCreationConfig = (input, context) => {
4347
3299
  return {
@@ -4497,7 +3449,7 @@ const deserializeAws_restJson1App = (output, context) => {
4497
3449
  };
4498
3450
  };
4499
3451
  const deserializeAws_restJson1Apps = (output, context) => {
4500
- return (output || [])
3452
+ const retVal = (output || [])
4501
3453
  .filter((e) => e != null)
4502
3454
  .map((entry) => {
4503
3455
  if (entry === null) {
@@ -4505,6 +3457,7 @@ const deserializeAws_restJson1Apps = (output, context) => {
4505
3457
  }
4506
3458
  return deserializeAws_restJson1App(entry, context);
4507
3459
  });
3460
+ return retVal;
4508
3461
  };
4509
3462
  const deserializeAws_restJson1Artifact = (output, context) => {
4510
3463
  return {
@@ -4513,7 +3466,7 @@ const deserializeAws_restJson1Artifact = (output, context) => {
4513
3466
  };
4514
3467
  };
4515
3468
  const deserializeAws_restJson1Artifacts = (output, context) => {
4516
- return (output || [])
3469
+ const retVal = (output || [])
4517
3470
  .filter((e) => e != null)
4518
3471
  .map((entry) => {
4519
3472
  if (entry === null) {
@@ -4521,9 +3474,10 @@ const deserializeAws_restJson1Artifacts = (output, context) => {
4521
3474
  }
4522
3475
  return deserializeAws_restJson1Artifact(entry, context);
4523
3476
  });
3477
+ return retVal;
4524
3478
  };
4525
3479
  const deserializeAws_restJson1AssociatedResources = (output, context) => {
4526
- return (output || [])
3480
+ const retVal = (output || [])
4527
3481
  .filter((e) => e != null)
4528
3482
  .map((entry) => {
4529
3483
  if (entry === null) {
@@ -4531,6 +3485,7 @@ const deserializeAws_restJson1AssociatedResources = (output, context) => {
4531
3485
  }
4532
3486
  return smithy_client_1.expectString(entry);
4533
3487
  });
3488
+ return retVal;
4534
3489
  };
4535
3490
  const deserializeAws_restJson1AutoBranchCreationConfig = (output, context) => {
4536
3491
  return {
@@ -4549,7 +3504,7 @@ const deserializeAws_restJson1AutoBranchCreationConfig = (output, context) => {
4549
3504
  };
4550
3505
  };
4551
3506
  const deserializeAws_restJson1AutoBranchCreationPatterns = (output, context) => {
4552
- return (output || [])
3507
+ const retVal = (output || [])
4553
3508
  .filter((e) => e != null)
4554
3509
  .map((entry) => {
4555
3510
  if (entry === null) {
@@ -4557,9 +3512,10 @@ const deserializeAws_restJson1AutoBranchCreationPatterns = (output, context) =>
4557
3512
  }
4558
3513
  return smithy_client_1.expectString(entry);
4559
3514
  });
3515
+ return retVal;
4560
3516
  };
4561
3517
  const deserializeAws_restJson1AutoSubDomainCreationPatterns = (output, context) => {
4562
- return (output || [])
3518
+ const retVal = (output || [])
4563
3519
  .filter((e) => e != null)
4564
3520
  .map((entry) => {
4565
3521
  if (entry === null) {
@@ -4567,6 +3523,7 @@ const deserializeAws_restJson1AutoSubDomainCreationPatterns = (output, context)
4567
3523
  }
4568
3524
  return smithy_client_1.expectString(entry);
4569
3525
  });
3526
+ return retVal;
4570
3527
  };
4571
3528
  const deserializeAws_restJson1BackendEnvironment = (output, context) => {
4572
3529
  return {
@@ -4583,7 +3540,7 @@ const deserializeAws_restJson1BackendEnvironment = (output, context) => {
4583
3540
  };
4584
3541
  };
4585
3542
  const deserializeAws_restJson1BackendEnvironments = (output, context) => {
4586
- return (output || [])
3543
+ const retVal = (output || [])
4587
3544
  .filter((e) => e != null)
4588
3545
  .map((entry) => {
4589
3546
  if (entry === null) {
@@ -4591,6 +3548,7 @@ const deserializeAws_restJson1BackendEnvironments = (output, context) => {
4591
3548
  }
4592
3549
  return deserializeAws_restJson1BackendEnvironment(entry, context);
4593
3550
  });
3551
+ return retVal;
4594
3552
  };
4595
3553
  const deserializeAws_restJson1Branch = (output, context) => {
4596
3554
  return {
@@ -4636,7 +3594,7 @@ const deserializeAws_restJson1Branch = (output, context) => {
4636
3594
  };
4637
3595
  };
4638
3596
  const deserializeAws_restJson1Branches = (output, context) => {
4639
- return (output || [])
3597
+ const retVal = (output || [])
4640
3598
  .filter((e) => e != null)
4641
3599
  .map((entry) => {
4642
3600
  if (entry === null) {
@@ -4644,9 +3602,10 @@ const deserializeAws_restJson1Branches = (output, context) => {
4644
3602
  }
4645
3603
  return deserializeAws_restJson1Branch(entry, context);
4646
3604
  });
3605
+ return retVal;
4647
3606
  };
4648
3607
  const deserializeAws_restJson1CustomDomains = (output, context) => {
4649
- return (output || [])
3608
+ const retVal = (output || [])
4650
3609
  .filter((e) => e != null)
4651
3610
  .map((entry) => {
4652
3611
  if (entry === null) {
@@ -4654,6 +3613,7 @@ const deserializeAws_restJson1CustomDomains = (output, context) => {
4654
3613
  }
4655
3614
  return smithy_client_1.expectString(entry);
4656
3615
  });
3616
+ return retVal;
4657
3617
  };
4658
3618
  const deserializeAws_restJson1CustomRule = (output, context) => {
4659
3619
  return {
@@ -4664,7 +3624,7 @@ const deserializeAws_restJson1CustomRule = (output, context) => {
4664
3624
  };
4665
3625
  };
4666
3626
  const deserializeAws_restJson1CustomRules = (output, context) => {
4667
- return (output || [])
3627
+ const retVal = (output || [])
4668
3628
  .filter((e) => e != null)
4669
3629
  .map((entry) => {
4670
3630
  if (entry === null) {
@@ -4672,6 +3632,7 @@ const deserializeAws_restJson1CustomRules = (output, context) => {
4672
3632
  }
4673
3633
  return deserializeAws_restJson1CustomRule(entry, context);
4674
3634
  });
3635
+ return retVal;
4675
3636
  };
4676
3637
  const deserializeAws_restJson1DomainAssociation = (output, context) => {
4677
3638
  return {
@@ -4691,7 +3652,7 @@ const deserializeAws_restJson1DomainAssociation = (output, context) => {
4691
3652
  };
4692
3653
  };
4693
3654
  const deserializeAws_restJson1DomainAssociations = (output, context) => {
4694
- return (output || [])
3655
+ const retVal = (output || [])
4695
3656
  .filter((e) => e != null)
4696
3657
  .map((entry) => {
4697
3658
  if (entry === null) {
@@ -4699,6 +3660,7 @@ const deserializeAws_restJson1DomainAssociations = (output, context) => {
4699
3660
  }
4700
3661
  return deserializeAws_restJson1DomainAssociation(entry, context);
4701
3662
  });
3663
+ return retVal;
4702
3664
  };
4703
3665
  const deserializeAws_restJson1EnvironmentVariables = (output, context) => {
4704
3666
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -4733,7 +3695,7 @@ const deserializeAws_restJson1Job = (output, context) => {
4733
3695
  };
4734
3696
  };
4735
3697
  const deserializeAws_restJson1JobSummaries = (output, context) => {
4736
- return (output || [])
3698
+ const retVal = (output || [])
4737
3699
  .filter((e) => e != null)
4738
3700
  .map((entry) => {
4739
3701
  if (entry === null) {
@@ -4741,6 +3703,7 @@ const deserializeAws_restJson1JobSummaries = (output, context) => {
4741
3703
  }
4742
3704
  return deserializeAws_restJson1JobSummary(entry, context);
4743
3705
  });
3706
+ return retVal;
4744
3707
  };
4745
3708
  const deserializeAws_restJson1JobSummary = (output, context) => {
4746
3709
  return {
@@ -4804,7 +3767,7 @@ const deserializeAws_restJson1Step = (output, context) => {
4804
3767
  };
4805
3768
  };
4806
3769
  const deserializeAws_restJson1Steps = (output, context) => {
4807
- return (output || [])
3770
+ const retVal = (output || [])
4808
3771
  .filter((e) => e != null)
4809
3772
  .map((entry) => {
4810
3773
  if (entry === null) {
@@ -4812,6 +3775,7 @@ const deserializeAws_restJson1Steps = (output, context) => {
4812
3775
  }
4813
3776
  return deserializeAws_restJson1Step(entry, context);
4814
3777
  });
3778
+ return retVal;
4815
3779
  };
4816
3780
  const deserializeAws_restJson1SubDomain = (output, context) => {
4817
3781
  return {
@@ -4823,7 +3787,7 @@ const deserializeAws_restJson1SubDomain = (output, context) => {
4823
3787
  };
4824
3788
  };
4825
3789
  const deserializeAws_restJson1SubDomains = (output, context) => {
4826
- return (output || [])
3790
+ const retVal = (output || [])
4827
3791
  .filter((e) => e != null)
4828
3792
  .map((entry) => {
4829
3793
  if (entry === null) {
@@ -4831,6 +3795,7 @@ const deserializeAws_restJson1SubDomains = (output, context) => {
4831
3795
  }
4832
3796
  return deserializeAws_restJson1SubDomain(entry, context);
4833
3797
  });
3798
+ return retVal;
4834
3799
  };
4835
3800
  const deserializeAws_restJson1SubDomainSetting = (output, context) => {
4836
3801
  return {
@@ -4865,7 +3830,7 @@ const deserializeAws_restJson1Webhook = (output, context) => {
4865
3830
  };
4866
3831
  };
4867
3832
  const deserializeAws_restJson1Webhooks = (output, context) => {
4868
- return (output || [])
3833
+ const retVal = (output || [])
4869
3834
  .filter((e) => e != null)
4870
3835
  .map((entry) => {
4871
3836
  if (entry === null) {
@@ -4873,6 +3838,7 @@ const deserializeAws_restJson1Webhooks = (output, context) => {
4873
3838
  }
4874
3839
  return deserializeAws_restJson1Webhook(entry, context);
4875
3840
  });
3841
+ return retVal;
4876
3842
  };
4877
3843
  const deserializeMetadata = (output) => {
4878
3844
  var _a;