@aws-sdk/client-synthetics 3.52.0 → 3.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_restJson1UpdateCanaryCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StopCanaryCommand = exports.deserializeAws_restJson1StartCanaryCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1GetCanaryRunsCommand = exports.deserializeAws_restJson1GetCanaryCommand = exports.deserializeAws_restJson1DescribeRuntimeVersionsCommand = exports.deserializeAws_restJson1DescribeCanariesLastRunCommand = exports.deserializeAws_restJson1DescribeCanariesCommand = exports.deserializeAws_restJson1DeleteCanaryCommand = exports.deserializeAws_restJson1CreateCanaryCommand = exports.serializeAws_restJson1UpdateCanaryCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StopCanaryCommand = exports.serializeAws_restJson1StartCanaryCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1GetCanaryRunsCommand = exports.serializeAws_restJson1GetCanaryCommand = exports.serializeAws_restJson1DescribeRuntimeVersionsCommand = exports.serializeAws_restJson1DescribeCanariesLastRunCommand = exports.serializeAws_restJson1DescribeCanariesCommand = exports.serializeAws_restJson1DeleteCanaryCommand = exports.serializeAws_restJson1CreateCanaryCommand = void 0;
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const models_0_1 = require("../models/models_0");
7
+ const SyntheticsServiceException_1 = require("../models/SyntheticsServiceException");
6
8
  const serializeAws_restJson1CreateCanaryCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {
@@ -430,43 +432,22 @@ const deserializeAws_restJson1CreateCanaryCommandError = async (output, context)
430
432
  switch (errorCode) {
431
433
  case "InternalServerException":
432
434
  case "com.amazonaws.synthetics#InternalServerException":
433
- response = {
434
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
435
- name: errorCode,
436
- $metadata: deserializeMetadata(output),
437
- };
438
- break;
435
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
439
436
  case "RequestEntityTooLargeException":
440
437
  case "com.amazonaws.synthetics#RequestEntityTooLargeException":
441
- response = {
442
- ...(await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context)),
443
- name: errorCode,
444
- $metadata: deserializeMetadata(output),
445
- };
446
- break;
438
+ throw await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context);
447
439
  case "ValidationException":
448
440
  case "com.amazonaws.synthetics#ValidationException":
449
- response = {
450
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
451
- name: errorCode,
452
- $metadata: deserializeMetadata(output),
453
- };
454
- break;
441
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
455
442
  default:
456
443
  const parsedBody = parsedOutput.body;
457
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
458
- response = {
459
- ...parsedBody,
460
- name: `${errorCode}`,
461
- message: parsedBody.message || parsedBody.Message || errorCode,
444
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
445
+ name: parsedBody.code || parsedBody.Code || errorCode,
462
446
  $fault: "client",
463
447
  $metadata: deserializeMetadata(output),
464
- };
448
+ });
449
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
465
450
  }
466
- const message = response.message || response.Message || errorCode;
467
- response.message = message;
468
- delete response.Message;
469
- return Promise.reject(Object.assign(new Error(message), response));
470
451
  };
471
452
  const deserializeAws_restJson1DeleteCanaryCommand = async (output, context) => {
472
453
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -490,51 +471,25 @@ const deserializeAws_restJson1DeleteCanaryCommandError = async (output, context)
490
471
  switch (errorCode) {
491
472
  case "ConflictException":
492
473
  case "com.amazonaws.synthetics#ConflictException":
493
- response = {
494
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
495
- name: errorCode,
496
- $metadata: deserializeMetadata(output),
497
- };
498
- break;
474
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
499
475
  case "InternalServerException":
500
476
  case "com.amazonaws.synthetics#InternalServerException":
501
- response = {
502
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
503
- name: errorCode,
504
- $metadata: deserializeMetadata(output),
505
- };
506
- break;
477
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
507
478
  case "ResourceNotFoundException":
508
479
  case "com.amazonaws.synthetics#ResourceNotFoundException":
509
- response = {
510
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
511
- name: errorCode,
512
- $metadata: deserializeMetadata(output),
513
- };
514
- break;
480
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
515
481
  case "ValidationException":
516
482
  case "com.amazonaws.synthetics#ValidationException":
517
- response = {
518
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
519
- name: errorCode,
520
- $metadata: deserializeMetadata(output),
521
- };
522
- break;
483
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
523
484
  default:
524
485
  const parsedBody = parsedOutput.body;
525
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
526
- response = {
527
- ...parsedBody,
528
- name: `${errorCode}`,
529
- message: parsedBody.message || parsedBody.Message || errorCode,
486
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
487
+ name: parsedBody.code || parsedBody.Code || errorCode,
530
488
  $fault: "client",
531
489
  $metadata: deserializeMetadata(output),
532
- };
490
+ });
491
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
533
492
  }
534
- const message = response.message || response.Message || errorCode;
535
- response.message = message;
536
- delete response.Message;
537
- return Promise.reject(Object.assign(new Error(message), response));
538
493
  };
539
494
  const deserializeAws_restJson1DescribeCanariesCommand = async (output, context) => {
540
495
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -566,35 +521,19 @@ const deserializeAws_restJson1DescribeCanariesCommandError = async (output, cont
566
521
  switch (errorCode) {
567
522
  case "InternalServerException":
568
523
  case "com.amazonaws.synthetics#InternalServerException":
569
- response = {
570
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
571
- name: errorCode,
572
- $metadata: deserializeMetadata(output),
573
- };
574
- break;
524
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
575
525
  case "ValidationException":
576
526
  case "com.amazonaws.synthetics#ValidationException":
577
- response = {
578
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
579
- name: errorCode,
580
- $metadata: deserializeMetadata(output),
581
- };
582
- break;
527
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
583
528
  default:
584
529
  const parsedBody = parsedOutput.body;
585
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
586
- response = {
587
- ...parsedBody,
588
- name: `${errorCode}`,
589
- message: parsedBody.message || parsedBody.Message || errorCode,
530
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
531
+ name: parsedBody.code || parsedBody.Code || errorCode,
590
532
  $fault: "client",
591
533
  $metadata: deserializeMetadata(output),
592
- };
534
+ });
535
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
593
536
  }
594
- const message = response.message || response.Message || errorCode;
595
- response.message = message;
596
- delete response.Message;
597
- return Promise.reject(Object.assign(new Error(message), response));
598
537
  };
599
538
  const deserializeAws_restJson1DescribeCanariesLastRunCommand = async (output, context) => {
600
539
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -626,35 +565,19 @@ const deserializeAws_restJson1DescribeCanariesLastRunCommandError = async (outpu
626
565
  switch (errorCode) {
627
566
  case "InternalServerException":
628
567
  case "com.amazonaws.synthetics#InternalServerException":
629
- response = {
630
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
631
- name: errorCode,
632
- $metadata: deserializeMetadata(output),
633
- };
634
- break;
568
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
635
569
  case "ValidationException":
636
570
  case "com.amazonaws.synthetics#ValidationException":
637
- response = {
638
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
639
- name: errorCode,
640
- $metadata: deserializeMetadata(output),
641
- };
642
- break;
571
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
643
572
  default:
644
573
  const parsedBody = parsedOutput.body;
645
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
646
- response = {
647
- ...parsedBody,
648
- name: `${errorCode}`,
649
- message: parsedBody.message || parsedBody.Message || errorCode,
574
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
575
+ name: parsedBody.code || parsedBody.Code || errorCode,
650
576
  $fault: "client",
651
577
  $metadata: deserializeMetadata(output),
652
- };
578
+ });
579
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
653
580
  }
654
- const message = response.message || response.Message || errorCode;
655
- response.message = message;
656
- delete response.Message;
657
- return Promise.reject(Object.assign(new Error(message), response));
658
581
  };
659
582
  const deserializeAws_restJson1DescribeRuntimeVersionsCommand = async (output, context) => {
660
583
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -686,35 +609,19 @@ const deserializeAws_restJson1DescribeRuntimeVersionsCommandError = async (outpu
686
609
  switch (errorCode) {
687
610
  case "InternalServerException":
688
611
  case "com.amazonaws.synthetics#InternalServerException":
689
- response = {
690
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
691
- name: errorCode,
692
- $metadata: deserializeMetadata(output),
693
- };
694
- break;
612
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
695
613
  case "ValidationException":
696
614
  case "com.amazonaws.synthetics#ValidationException":
697
- response = {
698
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
699
- name: errorCode,
700
- $metadata: deserializeMetadata(output),
701
- };
702
- break;
615
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
703
616
  default:
704
617
  const parsedBody = parsedOutput.body;
705
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
706
- response = {
707
- ...parsedBody,
708
- name: `${errorCode}`,
709
- message: parsedBody.message || parsedBody.Message || errorCode,
618
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
619
+ name: parsedBody.code || parsedBody.Code || errorCode,
710
620
  $fault: "client",
711
621
  $metadata: deserializeMetadata(output),
712
- };
622
+ });
623
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
713
624
  }
714
- const message = response.message || response.Message || errorCode;
715
- response.message = message;
716
- delete response.Message;
717
- return Promise.reject(Object.assign(new Error(message), response));
718
625
  };
719
626
  const deserializeAws_restJson1GetCanaryCommand = async (output, context) => {
720
627
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -742,35 +649,19 @@ const deserializeAws_restJson1GetCanaryCommandError = async (output, context) =>
742
649
  switch (errorCode) {
743
650
  case "InternalServerException":
744
651
  case "com.amazonaws.synthetics#InternalServerException":
745
- response = {
746
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
747
- name: errorCode,
748
- $metadata: deserializeMetadata(output),
749
- };
750
- break;
652
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
751
653
  case "ValidationException":
752
654
  case "com.amazonaws.synthetics#ValidationException":
753
- response = {
754
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
755
- name: errorCode,
756
- $metadata: deserializeMetadata(output),
757
- };
758
- break;
655
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
759
656
  default:
760
657
  const parsedBody = parsedOutput.body;
761
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
762
- response = {
763
- ...parsedBody,
764
- name: `${errorCode}`,
765
- message: parsedBody.message || parsedBody.Message || errorCode,
658
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
659
+ name: parsedBody.code || parsedBody.Code || errorCode,
766
660
  $fault: "client",
767
661
  $metadata: deserializeMetadata(output),
768
- };
662
+ });
663
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
769
664
  }
770
- const message = response.message || response.Message || errorCode;
771
- response.message = message;
772
- delete response.Message;
773
- return Promise.reject(Object.assign(new Error(message), response));
774
665
  };
775
666
  const deserializeAws_restJson1GetCanaryRunsCommand = async (output, context) => {
776
667
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -802,43 +693,22 @@ const deserializeAws_restJson1GetCanaryRunsCommandError = async (output, context
802
693
  switch (errorCode) {
803
694
  case "InternalServerException":
804
695
  case "com.amazonaws.synthetics#InternalServerException":
805
- response = {
806
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
807
- name: errorCode,
808
- $metadata: deserializeMetadata(output),
809
- };
810
- break;
696
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
811
697
  case "ResourceNotFoundException":
812
698
  case "com.amazonaws.synthetics#ResourceNotFoundException":
813
- response = {
814
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
815
- name: errorCode,
816
- $metadata: deserializeMetadata(output),
817
- };
818
- break;
699
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
819
700
  case "ValidationException":
820
701
  case "com.amazonaws.synthetics#ValidationException":
821
- response = {
822
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
823
- name: errorCode,
824
- $metadata: deserializeMetadata(output),
825
- };
826
- break;
702
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
827
703
  default:
828
704
  const parsedBody = parsedOutput.body;
829
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
830
- response = {
831
- ...parsedBody,
832
- name: `${errorCode}`,
833
- message: parsedBody.message || parsedBody.Message || errorCode,
705
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
706
+ name: parsedBody.code || parsedBody.Code || errorCode,
834
707
  $fault: "client",
835
708
  $metadata: deserializeMetadata(output),
836
- };
709
+ });
710
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
837
711
  }
838
- const message = response.message || response.Message || errorCode;
839
- response.message = message;
840
- delete response.Message;
841
- return Promise.reject(Object.assign(new Error(message), response));
842
712
  };
843
713
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
844
714
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -866,43 +736,22 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
866
736
  switch (errorCode) {
867
737
  case "InternalServerException":
868
738
  case "com.amazonaws.synthetics#InternalServerException":
869
- response = {
870
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
871
- name: errorCode,
872
- $metadata: deserializeMetadata(output),
873
- };
874
- break;
739
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
875
740
  case "ResourceNotFoundException":
876
741
  case "com.amazonaws.synthetics#ResourceNotFoundException":
877
- response = {
878
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
879
- name: errorCode,
880
- $metadata: deserializeMetadata(output),
881
- };
882
- break;
742
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
883
743
  case "ValidationException":
884
744
  case "com.amazonaws.synthetics#ValidationException":
885
- response = {
886
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
887
- name: errorCode,
888
- $metadata: deserializeMetadata(output),
889
- };
890
- break;
745
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
891
746
  default:
892
747
  const parsedBody = parsedOutput.body;
893
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
894
- response = {
895
- ...parsedBody,
896
- name: `${errorCode}`,
897
- message: parsedBody.message || parsedBody.Message || errorCode,
748
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
749
+ name: parsedBody.code || parsedBody.Code || errorCode,
898
750
  $fault: "client",
899
751
  $metadata: deserializeMetadata(output),
900
- };
752
+ });
753
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
901
754
  }
902
- const message = response.message || response.Message || errorCode;
903
- response.message = message;
904
- delete response.Message;
905
- return Promise.reject(Object.assign(new Error(message), response));
906
755
  };
907
756
  const deserializeAws_restJson1StartCanaryCommand = async (output, context) => {
908
757
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -926,51 +775,25 @@ const deserializeAws_restJson1StartCanaryCommandError = async (output, context)
926
775
  switch (errorCode) {
927
776
  case "ConflictException":
928
777
  case "com.amazonaws.synthetics#ConflictException":
929
- response = {
930
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
931
- name: errorCode,
932
- $metadata: deserializeMetadata(output),
933
- };
934
- break;
778
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
935
779
  case "InternalServerException":
936
780
  case "com.amazonaws.synthetics#InternalServerException":
937
- response = {
938
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
939
- name: errorCode,
940
- $metadata: deserializeMetadata(output),
941
- };
942
- break;
781
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
943
782
  case "ResourceNotFoundException":
944
783
  case "com.amazonaws.synthetics#ResourceNotFoundException":
945
- response = {
946
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
947
- name: errorCode,
948
- $metadata: deserializeMetadata(output),
949
- };
950
- break;
784
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
951
785
  case "ValidationException":
952
786
  case "com.amazonaws.synthetics#ValidationException":
953
- response = {
954
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
955
- name: errorCode,
956
- $metadata: deserializeMetadata(output),
957
- };
958
- break;
787
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
959
788
  default:
960
789
  const parsedBody = parsedOutput.body;
961
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
962
- response = {
963
- ...parsedBody,
964
- name: `${errorCode}`,
965
- message: parsedBody.message || parsedBody.Message || errorCode,
790
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
791
+ name: parsedBody.code || parsedBody.Code || errorCode,
966
792
  $fault: "client",
967
793
  $metadata: deserializeMetadata(output),
968
- };
794
+ });
795
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
969
796
  }
970
- const message = response.message || response.Message || errorCode;
971
- response.message = message;
972
- delete response.Message;
973
- return Promise.reject(Object.assign(new Error(message), response));
974
797
  };
975
798
  const deserializeAws_restJson1StopCanaryCommand = async (output, context) => {
976
799
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -994,51 +817,25 @@ const deserializeAws_restJson1StopCanaryCommandError = async (output, context) =
994
817
  switch (errorCode) {
995
818
  case "ConflictException":
996
819
  case "com.amazonaws.synthetics#ConflictException":
997
- response = {
998
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
999
- name: errorCode,
1000
- $metadata: deserializeMetadata(output),
1001
- };
1002
- break;
820
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1003
821
  case "InternalServerException":
1004
822
  case "com.amazonaws.synthetics#InternalServerException":
1005
- response = {
1006
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1007
- name: errorCode,
1008
- $metadata: deserializeMetadata(output),
1009
- };
1010
- break;
823
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1011
824
  case "ResourceNotFoundException":
1012
825
  case "com.amazonaws.synthetics#ResourceNotFoundException":
1013
- response = {
1014
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1015
- name: errorCode,
1016
- $metadata: deserializeMetadata(output),
1017
- };
1018
- break;
826
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1019
827
  case "ValidationException":
1020
828
  case "com.amazonaws.synthetics#ValidationException":
1021
- response = {
1022
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1023
- name: errorCode,
1024
- $metadata: deserializeMetadata(output),
1025
- };
1026
- break;
829
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1027
830
  default:
1028
831
  const parsedBody = parsedOutput.body;
1029
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1030
- response = {
1031
- ...parsedBody,
1032
- name: `${errorCode}`,
1033
- message: parsedBody.message || parsedBody.Message || errorCode,
832
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
833
+ name: parsedBody.code || parsedBody.Code || errorCode,
1034
834
  $fault: "client",
1035
835
  $metadata: deserializeMetadata(output),
1036
- };
836
+ });
837
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1037
838
  }
1038
- const message = response.message || response.Message || errorCode;
1039
- response.message = message;
1040
- delete response.Message;
1041
- return Promise.reject(Object.assign(new Error(message), response));
1042
839
  };
1043
840
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1044
841
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1062,43 +859,22 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1062
859
  switch (errorCode) {
1063
860
  case "InternalServerException":
1064
861
  case "com.amazonaws.synthetics#InternalServerException":
1065
- response = {
1066
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1067
- name: errorCode,
1068
- $metadata: deserializeMetadata(output),
1069
- };
1070
- break;
862
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1071
863
  case "ResourceNotFoundException":
1072
864
  case "com.amazonaws.synthetics#ResourceNotFoundException":
1073
- response = {
1074
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1075
- name: errorCode,
1076
- $metadata: deserializeMetadata(output),
1077
- };
1078
- break;
865
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1079
866
  case "ValidationException":
1080
867
  case "com.amazonaws.synthetics#ValidationException":
1081
- response = {
1082
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1083
- name: errorCode,
1084
- $metadata: deserializeMetadata(output),
1085
- };
1086
- break;
868
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1087
869
  default:
1088
870
  const parsedBody = parsedOutput.body;
1089
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1090
- response = {
1091
- ...parsedBody,
1092
- name: `${errorCode}`,
1093
- message: parsedBody.message || parsedBody.Message || errorCode,
871
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
872
+ name: parsedBody.code || parsedBody.Code || errorCode,
1094
873
  $fault: "client",
1095
874
  $metadata: deserializeMetadata(output),
1096
- };
875
+ });
876
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1097
877
  }
1098
- const message = response.message || response.Message || errorCode;
1099
- response.message = message;
1100
- delete response.Message;
1101
- return Promise.reject(Object.assign(new Error(message), response));
1102
878
  };
1103
879
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1104
880
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1122,43 +898,22 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1122
898
  switch (errorCode) {
1123
899
  case "InternalServerException":
1124
900
  case "com.amazonaws.synthetics#InternalServerException":
1125
- response = {
1126
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1127
- name: errorCode,
1128
- $metadata: deserializeMetadata(output),
1129
- };
1130
- break;
901
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1131
902
  case "ResourceNotFoundException":
1132
903
  case "com.amazonaws.synthetics#ResourceNotFoundException":
1133
- response = {
1134
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1135
- name: errorCode,
1136
- $metadata: deserializeMetadata(output),
1137
- };
1138
- break;
904
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1139
905
  case "ValidationException":
1140
906
  case "com.amazonaws.synthetics#ValidationException":
1141
- response = {
1142
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1143
- name: errorCode,
1144
- $metadata: deserializeMetadata(output),
1145
- };
1146
- break;
907
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1147
908
  default:
1148
909
  const parsedBody = parsedOutput.body;
1149
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1150
- response = {
1151
- ...parsedBody,
1152
- name: `${errorCode}`,
1153
- message: parsedBody.message || parsedBody.Message || errorCode,
910
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
911
+ name: parsedBody.code || parsedBody.Code || errorCode,
1154
912
  $fault: "client",
1155
913
  $metadata: deserializeMetadata(output),
1156
- };
914
+ });
915
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1157
916
  }
1158
- const message = response.message || response.Message || errorCode;
1159
- response.message = message;
1160
- delete response.Message;
1161
- return Promise.reject(Object.assign(new Error(message), response));
1162
917
  };
1163
918
  const deserializeAws_restJson1UpdateCanaryCommand = async (output, context) => {
1164
919
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1182,124 +937,88 @@ const deserializeAws_restJson1UpdateCanaryCommandError = async (output, context)
1182
937
  switch (errorCode) {
1183
938
  case "ConflictException":
1184
939
  case "com.amazonaws.synthetics#ConflictException":
1185
- response = {
1186
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1187
- name: errorCode,
1188
- $metadata: deserializeMetadata(output),
1189
- };
1190
- break;
940
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1191
941
  case "InternalServerException":
1192
942
  case "com.amazonaws.synthetics#InternalServerException":
1193
- response = {
1194
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1195
- name: errorCode,
1196
- $metadata: deserializeMetadata(output),
1197
- };
1198
- break;
943
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1199
944
  case "RequestEntityTooLargeException":
1200
945
  case "com.amazonaws.synthetics#RequestEntityTooLargeException":
1201
- response = {
1202
- ...(await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context)),
1203
- name: errorCode,
1204
- $metadata: deserializeMetadata(output),
1205
- };
1206
- break;
946
+ throw await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context);
1207
947
  case "ResourceNotFoundException":
1208
948
  case "com.amazonaws.synthetics#ResourceNotFoundException":
1209
- response = {
1210
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1211
- name: errorCode,
1212
- $metadata: deserializeMetadata(output),
1213
- };
1214
- break;
949
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1215
950
  case "ValidationException":
1216
951
  case "com.amazonaws.synthetics#ValidationException":
1217
- response = {
1218
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1219
- name: errorCode,
1220
- $metadata: deserializeMetadata(output),
1221
- };
1222
- break;
952
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1223
953
  default:
1224
954
  const parsedBody = parsedOutput.body;
1225
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1226
- response = {
1227
- ...parsedBody,
1228
- name: `${errorCode}`,
1229
- message: parsedBody.message || parsedBody.Message || errorCode,
955
+ response = new SyntheticsServiceException_1.SyntheticsServiceException({
956
+ name: parsedBody.code || parsedBody.Code || errorCode,
1230
957
  $fault: "client",
1231
958
  $metadata: deserializeMetadata(output),
1232
- };
959
+ });
960
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1233
961
  }
1234
- const message = response.message || response.Message || errorCode;
1235
- response.message = message;
1236
- delete response.Message;
1237
- return Promise.reject(Object.assign(new Error(message), response));
1238
962
  };
1239
963
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1240
- const contents = {
1241
- name: "ConflictException",
1242
- $fault: "client",
1243
- $metadata: deserializeMetadata(parsedOutput),
1244
- Message: undefined,
1245
- };
964
+ const contents = {};
1246
965
  const data = parsedOutput.body;
1247
966
  if (data.Message !== undefined && data.Message !== null) {
1248
967
  contents.Message = smithy_client_1.expectString(data.Message);
1249
968
  }
1250
- return contents;
969
+ const exception = new models_0_1.ConflictException({
970
+ $metadata: deserializeMetadata(parsedOutput),
971
+ ...contents,
972
+ });
973
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1251
974
  };
1252
975
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1253
- const contents = {
1254
- name: "InternalServerException",
1255
- $fault: "server",
1256
- $metadata: deserializeMetadata(parsedOutput),
1257
- Message: undefined,
1258
- };
976
+ const contents = {};
1259
977
  const data = parsedOutput.body;
1260
978
  if (data.Message !== undefined && data.Message !== null) {
1261
979
  contents.Message = smithy_client_1.expectString(data.Message);
1262
980
  }
1263
- return contents;
981
+ const exception = new models_0_1.InternalServerException({
982
+ $metadata: deserializeMetadata(parsedOutput),
983
+ ...contents,
984
+ });
985
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1264
986
  };
1265
987
  const deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = async (parsedOutput, context) => {
1266
- const contents = {
1267
- name: "RequestEntityTooLargeException",
1268
- $fault: "client",
1269
- $metadata: deserializeMetadata(parsedOutput),
1270
- Message: undefined,
1271
- };
988
+ const contents = {};
1272
989
  const data = parsedOutput.body;
1273
990
  if (data.Message !== undefined && data.Message !== null) {
1274
991
  contents.Message = smithy_client_1.expectString(data.Message);
1275
992
  }
1276
- return contents;
993
+ const exception = new models_0_1.RequestEntityTooLargeException({
994
+ $metadata: deserializeMetadata(parsedOutput),
995
+ ...contents,
996
+ });
997
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1277
998
  };
1278
999
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1279
- const contents = {
1280
- name: "ResourceNotFoundException",
1281
- $fault: "client",
1282
- $metadata: deserializeMetadata(parsedOutput),
1283
- Message: undefined,
1284
- };
1000
+ const contents = {};
1285
1001
  const data = parsedOutput.body;
1286
1002
  if (data.Message !== undefined && data.Message !== null) {
1287
1003
  contents.Message = smithy_client_1.expectString(data.Message);
1288
1004
  }
1289
- return contents;
1005
+ const exception = new models_0_1.ResourceNotFoundException({
1006
+ $metadata: deserializeMetadata(parsedOutput),
1007
+ ...contents,
1008
+ });
1009
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1290
1010
  };
1291
1011
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1292
- const contents = {
1293
- name: "ValidationException",
1294
- $fault: "client",
1295
- $metadata: deserializeMetadata(parsedOutput),
1296
- Message: undefined,
1297
- };
1012
+ const contents = {};
1298
1013
  const data = parsedOutput.body;
1299
1014
  if (data.Message !== undefined && data.Message !== null) {
1300
1015
  contents.Message = smithy_client_1.expectString(data.Message);
1301
1016
  }
1302
- return contents;
1017
+ const exception = new models_0_1.ValidationException({
1018
+ $metadata: deserializeMetadata(parsedOutput),
1019
+ ...contents,
1020
+ });
1021
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1303
1022
  };
1304
1023
  const serializeAws_restJson1ArtifactConfigInput = (input, context) => {
1305
1024
  return {
@@ -1472,7 +1191,7 @@ const deserializeAws_restJson1BaseScreenshot = (output, context) => {
1472
1191
  };
1473
1192
  };
1474
1193
  const deserializeAws_restJson1BaseScreenshotIgnoreCoordinates = (output, context) => {
1475
- return (output || [])
1194
+ const retVal = (output || [])
1476
1195
  .filter((e) => e != null)
1477
1196
  .map((entry) => {
1478
1197
  if (entry === null) {
@@ -1480,9 +1199,10 @@ const deserializeAws_restJson1BaseScreenshotIgnoreCoordinates = (output, context
1480
1199
  }
1481
1200
  return smithy_client_1.expectString(entry);
1482
1201
  });
1202
+ return retVal;
1483
1203
  };
1484
1204
  const deserializeAws_restJson1BaseScreenshots = (output, context) => {
1485
- return (output || [])
1205
+ const retVal = (output || [])
1486
1206
  .filter((e) => e != null)
1487
1207
  .map((entry) => {
1488
1208
  if (entry === null) {
@@ -1490,9 +1210,10 @@ const deserializeAws_restJson1BaseScreenshots = (output, context) => {
1490
1210
  }
1491
1211
  return deserializeAws_restJson1BaseScreenshot(entry, context);
1492
1212
  });
1213
+ return retVal;
1493
1214
  };
1494
1215
  const deserializeAws_restJson1Canaries = (output, context) => {
1495
- return (output || [])
1216
+ const retVal = (output || [])
1496
1217
  .filter((e) => e != null)
1497
1218
  .map((entry) => {
1498
1219
  if (entry === null) {
@@ -1500,9 +1221,10 @@ const deserializeAws_restJson1Canaries = (output, context) => {
1500
1221
  }
1501
1222
  return deserializeAws_restJson1Canary(entry, context);
1502
1223
  });
1224
+ return retVal;
1503
1225
  };
1504
1226
  const deserializeAws_restJson1CanariesLastRun = (output, context) => {
1505
- return (output || [])
1227
+ const retVal = (output || [])
1506
1228
  .filter((e) => e != null)
1507
1229
  .map((entry) => {
1508
1230
  if (entry === null) {
@@ -1510,6 +1232,7 @@ const deserializeAws_restJson1CanariesLastRun = (output, context) => {
1510
1232
  }
1511
1233
  return deserializeAws_restJson1CanaryLastRun(entry, context);
1512
1234
  });
1235
+ return retVal;
1513
1236
  };
1514
1237
  const deserializeAws_restJson1Canary = (output, context) => {
1515
1238
  return {
@@ -1585,7 +1308,7 @@ const deserializeAws_restJson1CanaryRunConfigOutput = (output, context) => {
1585
1308
  };
1586
1309
  };
1587
1310
  const deserializeAws_restJson1CanaryRuns = (output, context) => {
1588
- return (output || [])
1311
+ const retVal = (output || [])
1589
1312
  .filter((e) => e != null)
1590
1313
  .map((entry) => {
1591
1314
  if (entry === null) {
@@ -1593,6 +1316,7 @@ const deserializeAws_restJson1CanaryRuns = (output, context) => {
1593
1316
  }
1594
1317
  return deserializeAws_restJson1CanaryRun(entry, context);
1595
1318
  });
1319
+ return retVal;
1596
1320
  };
1597
1321
  const deserializeAws_restJson1CanaryRunStatus = (output, context) => {
1598
1322
  return {
@@ -1653,7 +1377,7 @@ const deserializeAws_restJson1RuntimeVersion = (output, context) => {
1653
1377
  };
1654
1378
  };
1655
1379
  const deserializeAws_restJson1RuntimeVersionList = (output, context) => {
1656
- return (output || [])
1380
+ const retVal = (output || [])
1657
1381
  .filter((e) => e != null)
1658
1382
  .map((entry) => {
1659
1383
  if (entry === null) {
@@ -1661,6 +1385,7 @@ const deserializeAws_restJson1RuntimeVersionList = (output, context) => {
1661
1385
  }
1662
1386
  return deserializeAws_restJson1RuntimeVersion(entry, context);
1663
1387
  });
1388
+ return retVal;
1664
1389
  };
1665
1390
  const deserializeAws_restJson1S3EncryptionConfig = (output, context) => {
1666
1391
  return {
@@ -1669,7 +1394,7 @@ const deserializeAws_restJson1S3EncryptionConfig = (output, context) => {
1669
1394
  };
1670
1395
  };
1671
1396
  const deserializeAws_restJson1SecurityGroupIds = (output, context) => {
1672
- return (output || [])
1397
+ const retVal = (output || [])
1673
1398
  .filter((e) => e != null)
1674
1399
  .map((entry) => {
1675
1400
  if (entry === null) {
@@ -1677,9 +1402,10 @@ const deserializeAws_restJson1SecurityGroupIds = (output, context) => {
1677
1402
  }
1678
1403
  return smithy_client_1.expectString(entry);
1679
1404
  });
1405
+ return retVal;
1680
1406
  };
1681
1407
  const deserializeAws_restJson1SubnetIds = (output, context) => {
1682
- return (output || [])
1408
+ const retVal = (output || [])
1683
1409
  .filter((e) => e != null)
1684
1410
  .map((entry) => {
1685
1411
  if (entry === null) {
@@ -1687,6 +1413,7 @@ const deserializeAws_restJson1SubnetIds = (output, context) => {
1687
1413
  }
1688
1414
  return smithy_client_1.expectString(entry);
1689
1415
  });
1416
+ return retVal;
1690
1417
  };
1691
1418
  const deserializeAws_restJson1TagMap = (output, context) => {
1692
1419
  return Object.entries(output).reduce((acc, [key, value]) => {