@aws-sdk/client-detective 3.51.0 → 3.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_restJson1UpdateOrganizationConfigurationCommand = exports.deserializeAws_restJson1UntagResourceCommand = exports.deserializeAws_restJson1TagResourceCommand = exports.deserializeAws_restJson1StartMonitoringMemberCommand = exports.deserializeAws_restJson1RejectInvitationCommand = exports.deserializeAws_restJson1ListTagsForResourceCommand = exports.deserializeAws_restJson1ListOrganizationAdminAccountsCommand = exports.deserializeAws_restJson1ListMembersCommand = exports.deserializeAws_restJson1ListInvitationsCommand = exports.deserializeAws_restJson1ListGraphsCommand = exports.deserializeAws_restJson1GetMembersCommand = exports.deserializeAws_restJson1EnableOrganizationAdminAccountCommand = exports.deserializeAws_restJson1DisassociateMembershipCommand = exports.deserializeAws_restJson1DisableOrganizationAdminAccountCommand = exports.deserializeAws_restJson1DescribeOrganizationConfigurationCommand = exports.deserializeAws_restJson1DeleteMembersCommand = exports.deserializeAws_restJson1DeleteGraphCommand = exports.deserializeAws_restJson1CreateMembersCommand = exports.deserializeAws_restJson1CreateGraphCommand = exports.deserializeAws_restJson1AcceptInvitationCommand = exports.serializeAws_restJson1UpdateOrganizationConfigurationCommand = exports.serializeAws_restJson1UntagResourceCommand = exports.serializeAws_restJson1TagResourceCommand = exports.serializeAws_restJson1StartMonitoringMemberCommand = exports.serializeAws_restJson1RejectInvitationCommand = exports.serializeAws_restJson1ListTagsForResourceCommand = exports.serializeAws_restJson1ListOrganizationAdminAccountsCommand = exports.serializeAws_restJson1ListMembersCommand = exports.serializeAws_restJson1ListInvitationsCommand = exports.serializeAws_restJson1ListGraphsCommand = exports.serializeAws_restJson1GetMembersCommand = exports.serializeAws_restJson1EnableOrganizationAdminAccountCommand = exports.serializeAws_restJson1DisassociateMembershipCommand = exports.serializeAws_restJson1DisableOrganizationAdminAccountCommand = exports.serializeAws_restJson1DescribeOrganizationConfigurationCommand = exports.serializeAws_restJson1DeleteMembersCommand = exports.serializeAws_restJson1DeleteGraphCommand = exports.serializeAws_restJson1CreateMembersCommand = exports.serializeAws_restJson1CreateGraphCommand = exports.serializeAws_restJson1AcceptInvitationCommand = 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 DetectiveServiceException_1 = require("../models/DetectiveServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_restJson1AcceptInvitationCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {
@@ -483,51 +485,25 @@ const deserializeAws_restJson1AcceptInvitationCommandError = async (output, cont
483
485
  switch (errorCode) {
484
486
  case "ConflictException":
485
487
  case "com.amazonaws.detective#ConflictException":
486
- response = {
487
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
488
- name: errorCode,
489
- $metadata: deserializeMetadata(output),
490
- };
491
- break;
488
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
492
489
  case "InternalServerException":
493
490
  case "com.amazonaws.detective#InternalServerException":
494
- response = {
495
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
496
- name: errorCode,
497
- $metadata: deserializeMetadata(output),
498
- };
499
- break;
491
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
500
492
  case "ResourceNotFoundException":
501
493
  case "com.amazonaws.detective#ResourceNotFoundException":
502
- response = {
503
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
504
- name: errorCode,
505
- $metadata: deserializeMetadata(output),
506
- };
507
- break;
494
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
508
495
  case "ValidationException":
509
496
  case "com.amazonaws.detective#ValidationException":
510
- response = {
511
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
512
- name: errorCode,
513
- $metadata: deserializeMetadata(output),
514
- };
515
- break;
497
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
516
498
  default:
517
499
  const parsedBody = parsedOutput.body;
518
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
519
- response = {
520
- ...parsedBody,
521
- name: `${errorCode}`,
522
- message: parsedBody.message || parsedBody.Message || errorCode,
500
+ response = new DetectiveServiceException_1.DetectiveServiceException({
501
+ name: parsedBody.code || parsedBody.Code || errorCode,
523
502
  $fault: "client",
524
503
  $metadata: deserializeMetadata(output),
525
- };
504
+ });
505
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
526
506
  }
527
- const message = response.message || response.Message || errorCode;
528
- response.message = message;
529
- delete response.Message;
530
- return Promise.reject(Object.assign(new Error(message), response));
531
507
  };
532
508
  const deserializeAws_restJson1CreateGraphCommand = async (output, context) => {
533
509
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -555,43 +531,22 @@ const deserializeAws_restJson1CreateGraphCommandError = async (output, context)
555
531
  switch (errorCode) {
556
532
  case "ConflictException":
557
533
  case "com.amazonaws.detective#ConflictException":
558
- response = {
559
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
560
- name: errorCode,
561
- $metadata: deserializeMetadata(output),
562
- };
563
- break;
534
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
564
535
  case "InternalServerException":
565
536
  case "com.amazonaws.detective#InternalServerException":
566
- response = {
567
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
568
- name: errorCode,
569
- $metadata: deserializeMetadata(output),
570
- };
571
- break;
537
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
572
538
  case "ServiceQuotaExceededException":
573
539
  case "com.amazonaws.detective#ServiceQuotaExceededException":
574
- response = {
575
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
576
- name: errorCode,
577
- $metadata: deserializeMetadata(output),
578
- };
579
- break;
540
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
580
541
  default:
581
542
  const parsedBody = parsedOutput.body;
582
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
583
- response = {
584
- ...parsedBody,
585
- name: `${errorCode}`,
586
- message: parsedBody.message || parsedBody.Message || errorCode,
543
+ response = new DetectiveServiceException_1.DetectiveServiceException({
544
+ name: parsedBody.code || parsedBody.Code || errorCode,
587
545
  $fault: "client",
588
546
  $metadata: deserializeMetadata(output),
589
- };
547
+ });
548
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
590
549
  }
591
- const message = response.message || response.Message || errorCode;
592
- response.message = message;
593
- delete response.Message;
594
- return Promise.reject(Object.assign(new Error(message), response));
595
550
  };
596
551
  const deserializeAws_restJson1CreateMembersCommand = async (output, context) => {
597
552
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -623,51 +578,25 @@ const deserializeAws_restJson1CreateMembersCommandError = async (output, context
623
578
  switch (errorCode) {
624
579
  case "InternalServerException":
625
580
  case "com.amazonaws.detective#InternalServerException":
626
- response = {
627
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
628
- name: errorCode,
629
- $metadata: deserializeMetadata(output),
630
- };
631
- break;
581
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
632
582
  case "ResourceNotFoundException":
633
583
  case "com.amazonaws.detective#ResourceNotFoundException":
634
- response = {
635
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
636
- name: errorCode,
637
- $metadata: deserializeMetadata(output),
638
- };
639
- break;
584
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
640
585
  case "ServiceQuotaExceededException":
641
586
  case "com.amazonaws.detective#ServiceQuotaExceededException":
642
- response = {
643
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
644
- name: errorCode,
645
- $metadata: deserializeMetadata(output),
646
- };
647
- break;
587
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
648
588
  case "ValidationException":
649
589
  case "com.amazonaws.detective#ValidationException":
650
- response = {
651
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
652
- name: errorCode,
653
- $metadata: deserializeMetadata(output),
654
- };
655
- break;
590
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
656
591
  default:
657
592
  const parsedBody = parsedOutput.body;
658
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
659
- response = {
660
- ...parsedBody,
661
- name: `${errorCode}`,
662
- message: parsedBody.message || parsedBody.Message || errorCode,
593
+ response = new DetectiveServiceException_1.DetectiveServiceException({
594
+ name: parsedBody.code || parsedBody.Code || errorCode,
663
595
  $fault: "client",
664
596
  $metadata: deserializeMetadata(output),
665
- };
597
+ });
598
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
666
599
  }
667
- const message = response.message || response.Message || errorCode;
668
- response.message = message;
669
- delete response.Message;
670
- return Promise.reject(Object.assign(new Error(message), response));
671
600
  };
672
601
  const deserializeAws_restJson1DeleteGraphCommand = async (output, context) => {
673
602
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -691,43 +620,22 @@ const deserializeAws_restJson1DeleteGraphCommandError = async (output, context)
691
620
  switch (errorCode) {
692
621
  case "InternalServerException":
693
622
  case "com.amazonaws.detective#InternalServerException":
694
- response = {
695
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
696
- name: errorCode,
697
- $metadata: deserializeMetadata(output),
698
- };
699
- break;
623
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
700
624
  case "ResourceNotFoundException":
701
625
  case "com.amazonaws.detective#ResourceNotFoundException":
702
- response = {
703
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
704
- name: errorCode,
705
- $metadata: deserializeMetadata(output),
706
- };
707
- break;
626
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
708
627
  case "ValidationException":
709
628
  case "com.amazonaws.detective#ValidationException":
710
- response = {
711
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
712
- name: errorCode,
713
- $metadata: deserializeMetadata(output),
714
- };
715
- break;
629
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
716
630
  default:
717
631
  const parsedBody = parsedOutput.body;
718
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
719
- response = {
720
- ...parsedBody,
721
- name: `${errorCode}`,
722
- message: parsedBody.message || parsedBody.Message || errorCode,
632
+ response = new DetectiveServiceException_1.DetectiveServiceException({
633
+ name: parsedBody.code || parsedBody.Code || errorCode,
723
634
  $fault: "client",
724
635
  $metadata: deserializeMetadata(output),
725
- };
636
+ });
637
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
726
638
  }
727
- const message = response.message || response.Message || errorCode;
728
- response.message = message;
729
- delete response.Message;
730
- return Promise.reject(Object.assign(new Error(message), response));
731
639
  };
732
640
  const deserializeAws_restJson1DeleteMembersCommand = async (output, context) => {
733
641
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -759,51 +667,25 @@ const deserializeAws_restJson1DeleteMembersCommandError = async (output, context
759
667
  switch (errorCode) {
760
668
  case "ConflictException":
761
669
  case "com.amazonaws.detective#ConflictException":
762
- response = {
763
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
764
- name: errorCode,
765
- $metadata: deserializeMetadata(output),
766
- };
767
- break;
670
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
768
671
  case "InternalServerException":
769
672
  case "com.amazonaws.detective#InternalServerException":
770
- response = {
771
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
772
- name: errorCode,
773
- $metadata: deserializeMetadata(output),
774
- };
775
- break;
673
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
776
674
  case "ResourceNotFoundException":
777
675
  case "com.amazonaws.detective#ResourceNotFoundException":
778
- response = {
779
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
780
- name: errorCode,
781
- $metadata: deserializeMetadata(output),
782
- };
783
- break;
676
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
784
677
  case "ValidationException":
785
678
  case "com.amazonaws.detective#ValidationException":
786
- response = {
787
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
788
- name: errorCode,
789
- $metadata: deserializeMetadata(output),
790
- };
791
- break;
679
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
792
680
  default:
793
681
  const parsedBody = parsedOutput.body;
794
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
795
- response = {
796
- ...parsedBody,
797
- name: `${errorCode}`,
798
- message: parsedBody.message || parsedBody.Message || errorCode,
682
+ response = new DetectiveServiceException_1.DetectiveServiceException({
683
+ name: parsedBody.code || parsedBody.Code || errorCode,
799
684
  $fault: "client",
800
685
  $metadata: deserializeMetadata(output),
801
- };
686
+ });
687
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
802
688
  }
803
- const message = response.message || response.Message || errorCode;
804
- response.message = message;
805
- delete response.Message;
806
- return Promise.reject(Object.assign(new Error(message), response));
807
689
  };
808
690
  const deserializeAws_restJson1DescribeOrganizationConfigurationCommand = async (output, context) => {
809
691
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -831,43 +713,22 @@ const deserializeAws_restJson1DescribeOrganizationConfigurationCommandError = as
831
713
  switch (errorCode) {
832
714
  case "InternalServerException":
833
715
  case "com.amazonaws.detective#InternalServerException":
834
- response = {
835
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
836
- name: errorCode,
837
- $metadata: deserializeMetadata(output),
838
- };
839
- break;
716
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
840
717
  case "TooManyRequestsException":
841
718
  case "com.amazonaws.detective#TooManyRequestsException":
842
- response = {
843
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
844
- name: errorCode,
845
- $metadata: deserializeMetadata(output),
846
- };
847
- break;
719
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
848
720
  case "ValidationException":
849
721
  case "com.amazonaws.detective#ValidationException":
850
- response = {
851
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
852
- name: errorCode,
853
- $metadata: deserializeMetadata(output),
854
- };
855
- break;
722
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
856
723
  default:
857
724
  const parsedBody = parsedOutput.body;
858
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
859
- response = {
860
- ...parsedBody,
861
- name: `${errorCode}`,
862
- message: parsedBody.message || parsedBody.Message || errorCode,
725
+ response = new DetectiveServiceException_1.DetectiveServiceException({
726
+ name: parsedBody.code || parsedBody.Code || errorCode,
863
727
  $fault: "client",
864
728
  $metadata: deserializeMetadata(output),
865
- };
729
+ });
730
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
866
731
  }
867
- const message = response.message || response.Message || errorCode;
868
- response.message = message;
869
- delete response.Message;
870
- return Promise.reject(Object.assign(new Error(message), response));
871
732
  };
872
733
  const deserializeAws_restJson1DisableOrganizationAdminAccountCommand = async (output, context) => {
873
734
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -891,43 +752,22 @@ const deserializeAws_restJson1DisableOrganizationAdminAccountCommandError = asyn
891
752
  switch (errorCode) {
892
753
  case "InternalServerException":
893
754
  case "com.amazonaws.detective#InternalServerException":
894
- response = {
895
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
896
- name: errorCode,
897
- $metadata: deserializeMetadata(output),
898
- };
899
- break;
755
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
900
756
  case "TooManyRequestsException":
901
757
  case "com.amazonaws.detective#TooManyRequestsException":
902
- response = {
903
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
904
- name: errorCode,
905
- $metadata: deserializeMetadata(output),
906
- };
907
- break;
758
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
908
759
  case "ValidationException":
909
760
  case "com.amazonaws.detective#ValidationException":
910
- response = {
911
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
912
- name: errorCode,
913
- $metadata: deserializeMetadata(output),
914
- };
915
- break;
761
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
916
762
  default:
917
763
  const parsedBody = parsedOutput.body;
918
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
919
- response = {
920
- ...parsedBody,
921
- name: `${errorCode}`,
922
- message: parsedBody.message || parsedBody.Message || errorCode,
764
+ response = new DetectiveServiceException_1.DetectiveServiceException({
765
+ name: parsedBody.code || parsedBody.Code || errorCode,
923
766
  $fault: "client",
924
767
  $metadata: deserializeMetadata(output),
925
- };
768
+ });
769
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
926
770
  }
927
- const message = response.message || response.Message || errorCode;
928
- response.message = message;
929
- delete response.Message;
930
- return Promise.reject(Object.assign(new Error(message), response));
931
771
  };
932
772
  const deserializeAws_restJson1DisassociateMembershipCommand = async (output, context) => {
933
773
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -951,51 +791,25 @@ const deserializeAws_restJson1DisassociateMembershipCommandError = async (output
951
791
  switch (errorCode) {
952
792
  case "ConflictException":
953
793
  case "com.amazonaws.detective#ConflictException":
954
- response = {
955
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
956
- name: errorCode,
957
- $metadata: deserializeMetadata(output),
958
- };
959
- break;
794
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
960
795
  case "InternalServerException":
961
796
  case "com.amazonaws.detective#InternalServerException":
962
- response = {
963
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
964
- name: errorCode,
965
- $metadata: deserializeMetadata(output),
966
- };
967
- break;
797
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
968
798
  case "ResourceNotFoundException":
969
799
  case "com.amazonaws.detective#ResourceNotFoundException":
970
- response = {
971
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
972
- name: errorCode,
973
- $metadata: deserializeMetadata(output),
974
- };
975
- break;
800
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
976
801
  case "ValidationException":
977
802
  case "com.amazonaws.detective#ValidationException":
978
- response = {
979
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
980
- name: errorCode,
981
- $metadata: deserializeMetadata(output),
982
- };
983
- break;
803
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
984
804
  default:
985
805
  const parsedBody = parsedOutput.body;
986
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
987
- response = {
988
- ...parsedBody,
989
- name: `${errorCode}`,
990
- message: parsedBody.message || parsedBody.Message || errorCode,
806
+ response = new DetectiveServiceException_1.DetectiveServiceException({
807
+ name: parsedBody.code || parsedBody.Code || errorCode,
991
808
  $fault: "client",
992
809
  $metadata: deserializeMetadata(output),
993
- };
810
+ });
811
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
994
812
  }
995
- const message = response.message || response.Message || errorCode;
996
- response.message = message;
997
- delete response.Message;
998
- return Promise.reject(Object.assign(new Error(message), response));
999
813
  };
1000
814
  const deserializeAws_restJson1EnableOrganizationAdminAccountCommand = async (output, context) => {
1001
815
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1019,43 +833,22 @@ const deserializeAws_restJson1EnableOrganizationAdminAccountCommandError = async
1019
833
  switch (errorCode) {
1020
834
  case "InternalServerException":
1021
835
  case "com.amazonaws.detective#InternalServerException":
1022
- response = {
1023
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1024
- name: errorCode,
1025
- $metadata: deserializeMetadata(output),
1026
- };
1027
- break;
836
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1028
837
  case "TooManyRequestsException":
1029
838
  case "com.amazonaws.detective#TooManyRequestsException":
1030
- response = {
1031
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1032
- name: errorCode,
1033
- $metadata: deserializeMetadata(output),
1034
- };
1035
- break;
839
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1036
840
  case "ValidationException":
1037
841
  case "com.amazonaws.detective#ValidationException":
1038
- response = {
1039
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1040
- name: errorCode,
1041
- $metadata: deserializeMetadata(output),
1042
- };
1043
- break;
842
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1044
843
  default:
1045
844
  const parsedBody = parsedOutput.body;
1046
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1047
- response = {
1048
- ...parsedBody,
1049
- name: `${errorCode}`,
1050
- message: parsedBody.message || parsedBody.Message || errorCode,
845
+ response = new DetectiveServiceException_1.DetectiveServiceException({
846
+ name: parsedBody.code || parsedBody.Code || errorCode,
1051
847
  $fault: "client",
1052
848
  $metadata: deserializeMetadata(output),
1053
- };
849
+ });
850
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1054
851
  }
1055
- const message = response.message || response.Message || errorCode;
1056
- response.message = message;
1057
- delete response.Message;
1058
- return Promise.reject(Object.assign(new Error(message), response));
1059
852
  };
1060
853
  const deserializeAws_restJson1GetMembersCommand = async (output, context) => {
1061
854
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1087,43 +880,22 @@ const deserializeAws_restJson1GetMembersCommandError = async (output, context) =
1087
880
  switch (errorCode) {
1088
881
  case "InternalServerException":
1089
882
  case "com.amazonaws.detective#InternalServerException":
1090
- response = {
1091
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1092
- name: errorCode,
1093
- $metadata: deserializeMetadata(output),
1094
- };
1095
- break;
883
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1096
884
  case "ResourceNotFoundException":
1097
885
  case "com.amazonaws.detective#ResourceNotFoundException":
1098
- response = {
1099
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1100
- name: errorCode,
1101
- $metadata: deserializeMetadata(output),
1102
- };
1103
- break;
886
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1104
887
  case "ValidationException":
1105
888
  case "com.amazonaws.detective#ValidationException":
1106
- response = {
1107
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1108
- name: errorCode,
1109
- $metadata: deserializeMetadata(output),
1110
- };
1111
- break;
889
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1112
890
  default:
1113
891
  const parsedBody = parsedOutput.body;
1114
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1115
- response = {
1116
- ...parsedBody,
1117
- name: `${errorCode}`,
1118
- message: parsedBody.message || parsedBody.Message || errorCode,
892
+ response = new DetectiveServiceException_1.DetectiveServiceException({
893
+ name: parsedBody.code || parsedBody.Code || errorCode,
1119
894
  $fault: "client",
1120
895
  $metadata: deserializeMetadata(output),
1121
- };
896
+ });
897
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1122
898
  }
1123
- const message = response.message || response.Message || errorCode;
1124
- response.message = message;
1125
- delete response.Message;
1126
- return Promise.reject(Object.assign(new Error(message), response));
1127
899
  };
1128
900
  const deserializeAws_restJson1ListGraphsCommand = async (output, context) => {
1129
901
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1155,35 +927,19 @@ const deserializeAws_restJson1ListGraphsCommandError = async (output, context) =
1155
927
  switch (errorCode) {
1156
928
  case "InternalServerException":
1157
929
  case "com.amazonaws.detective#InternalServerException":
1158
- response = {
1159
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1160
- name: errorCode,
1161
- $metadata: deserializeMetadata(output),
1162
- };
1163
- break;
930
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1164
931
  case "ValidationException":
1165
932
  case "com.amazonaws.detective#ValidationException":
1166
- response = {
1167
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1168
- name: errorCode,
1169
- $metadata: deserializeMetadata(output),
1170
- };
1171
- break;
933
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1172
934
  default:
1173
935
  const parsedBody = parsedOutput.body;
1174
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1175
- response = {
1176
- ...parsedBody,
1177
- name: `${errorCode}`,
1178
- message: parsedBody.message || parsedBody.Message || errorCode,
936
+ response = new DetectiveServiceException_1.DetectiveServiceException({
937
+ name: parsedBody.code || parsedBody.Code || errorCode,
1179
938
  $fault: "client",
1180
939
  $metadata: deserializeMetadata(output),
1181
- };
940
+ });
941
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1182
942
  }
1183
- const message = response.message || response.Message || errorCode;
1184
- response.message = message;
1185
- delete response.Message;
1186
- return Promise.reject(Object.assign(new Error(message), response));
1187
943
  };
1188
944
  const deserializeAws_restJson1ListInvitationsCommand = async (output, context) => {
1189
945
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1215,35 +971,19 @@ const deserializeAws_restJson1ListInvitationsCommandError = async (output, conte
1215
971
  switch (errorCode) {
1216
972
  case "InternalServerException":
1217
973
  case "com.amazonaws.detective#InternalServerException":
1218
- response = {
1219
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1220
- name: errorCode,
1221
- $metadata: deserializeMetadata(output),
1222
- };
1223
- break;
974
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1224
975
  case "ValidationException":
1225
976
  case "com.amazonaws.detective#ValidationException":
1226
- response = {
1227
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1228
- name: errorCode,
1229
- $metadata: deserializeMetadata(output),
1230
- };
1231
- break;
977
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1232
978
  default:
1233
979
  const parsedBody = parsedOutput.body;
1234
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1235
- response = {
1236
- ...parsedBody,
1237
- name: `${errorCode}`,
1238
- message: parsedBody.message || parsedBody.Message || errorCode,
980
+ response = new DetectiveServiceException_1.DetectiveServiceException({
981
+ name: parsedBody.code || parsedBody.Code || errorCode,
1239
982
  $fault: "client",
1240
983
  $metadata: deserializeMetadata(output),
1241
- };
984
+ });
985
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1242
986
  }
1243
- const message = response.message || response.Message || errorCode;
1244
- response.message = message;
1245
- delete response.Message;
1246
- return Promise.reject(Object.assign(new Error(message), response));
1247
987
  };
1248
988
  const deserializeAws_restJson1ListMembersCommand = async (output, context) => {
1249
989
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1275,43 +1015,22 @@ const deserializeAws_restJson1ListMembersCommandError = async (output, context)
1275
1015
  switch (errorCode) {
1276
1016
  case "InternalServerException":
1277
1017
  case "com.amazonaws.detective#InternalServerException":
1278
- response = {
1279
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1280
- name: errorCode,
1281
- $metadata: deserializeMetadata(output),
1282
- };
1283
- break;
1018
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1284
1019
  case "ResourceNotFoundException":
1285
1020
  case "com.amazonaws.detective#ResourceNotFoundException":
1286
- response = {
1287
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1288
- name: errorCode,
1289
- $metadata: deserializeMetadata(output),
1290
- };
1291
- break;
1021
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1292
1022
  case "ValidationException":
1293
1023
  case "com.amazonaws.detective#ValidationException":
1294
- response = {
1295
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1296
- name: errorCode,
1297
- $metadata: deserializeMetadata(output),
1298
- };
1299
- break;
1024
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1300
1025
  default:
1301
1026
  const parsedBody = parsedOutput.body;
1302
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1303
- response = {
1304
- ...parsedBody,
1305
- name: `${errorCode}`,
1306
- message: parsedBody.message || parsedBody.Message || errorCode,
1027
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1028
+ name: parsedBody.code || parsedBody.Code || errorCode,
1307
1029
  $fault: "client",
1308
1030
  $metadata: deserializeMetadata(output),
1309
- };
1031
+ });
1032
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1310
1033
  }
1311
- const message = response.message || response.Message || errorCode;
1312
- response.message = message;
1313
- delete response.Message;
1314
- return Promise.reject(Object.assign(new Error(message), response));
1315
1034
  };
1316
1035
  const deserializeAws_restJson1ListOrganizationAdminAccountsCommand = async (output, context) => {
1317
1036
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1343,43 +1062,22 @@ const deserializeAws_restJson1ListOrganizationAdminAccountsCommandError = async
1343
1062
  switch (errorCode) {
1344
1063
  case "InternalServerException":
1345
1064
  case "com.amazonaws.detective#InternalServerException":
1346
- response = {
1347
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1348
- name: errorCode,
1349
- $metadata: deserializeMetadata(output),
1350
- };
1351
- break;
1065
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1352
1066
  case "TooManyRequestsException":
1353
1067
  case "com.amazonaws.detective#TooManyRequestsException":
1354
- response = {
1355
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1356
- name: errorCode,
1357
- $metadata: deserializeMetadata(output),
1358
- };
1359
- break;
1068
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1360
1069
  case "ValidationException":
1361
1070
  case "com.amazonaws.detective#ValidationException":
1362
- response = {
1363
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1364
- name: errorCode,
1365
- $metadata: deserializeMetadata(output),
1366
- };
1367
- break;
1071
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1368
1072
  default:
1369
1073
  const parsedBody = parsedOutput.body;
1370
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1371
- response = {
1372
- ...parsedBody,
1373
- name: `${errorCode}`,
1374
- message: parsedBody.message || parsedBody.Message || errorCode,
1074
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1075
+ name: parsedBody.code || parsedBody.Code || errorCode,
1375
1076
  $fault: "client",
1376
1077
  $metadata: deserializeMetadata(output),
1377
- };
1078
+ });
1079
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1378
1080
  }
1379
- const message = response.message || response.Message || errorCode;
1380
- response.message = message;
1381
- delete response.Message;
1382
- return Promise.reject(Object.assign(new Error(message), response));
1383
1081
  };
1384
1082
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1385
1083
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1407,43 +1105,22 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1407
1105
  switch (errorCode) {
1408
1106
  case "InternalServerException":
1409
1107
  case "com.amazonaws.detective#InternalServerException":
1410
- response = {
1411
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1412
- name: errorCode,
1413
- $metadata: deserializeMetadata(output),
1414
- };
1415
- break;
1108
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1416
1109
  case "ResourceNotFoundException":
1417
1110
  case "com.amazonaws.detective#ResourceNotFoundException":
1418
- response = {
1419
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1420
- name: errorCode,
1421
- $metadata: deserializeMetadata(output),
1422
- };
1423
- break;
1111
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1424
1112
  case "ValidationException":
1425
1113
  case "com.amazonaws.detective#ValidationException":
1426
- response = {
1427
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1428
- name: errorCode,
1429
- $metadata: deserializeMetadata(output),
1430
- };
1431
- break;
1114
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1432
1115
  default:
1433
1116
  const parsedBody = parsedOutput.body;
1434
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1435
- response = {
1436
- ...parsedBody,
1437
- name: `${errorCode}`,
1438
- message: parsedBody.message || parsedBody.Message || errorCode,
1117
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1118
+ name: parsedBody.code || parsedBody.Code || errorCode,
1439
1119
  $fault: "client",
1440
1120
  $metadata: deserializeMetadata(output),
1441
- };
1121
+ });
1122
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1442
1123
  }
1443
- const message = response.message || response.Message || errorCode;
1444
- response.message = message;
1445
- delete response.Message;
1446
- return Promise.reject(Object.assign(new Error(message), response));
1447
1124
  };
1448
1125
  const deserializeAws_restJson1RejectInvitationCommand = async (output, context) => {
1449
1126
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1467,51 +1144,25 @@ const deserializeAws_restJson1RejectInvitationCommandError = async (output, cont
1467
1144
  switch (errorCode) {
1468
1145
  case "ConflictException":
1469
1146
  case "com.amazonaws.detective#ConflictException":
1470
- response = {
1471
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1472
- name: errorCode,
1473
- $metadata: deserializeMetadata(output),
1474
- };
1475
- break;
1147
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1476
1148
  case "InternalServerException":
1477
1149
  case "com.amazonaws.detective#InternalServerException":
1478
- response = {
1479
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1480
- name: errorCode,
1481
- $metadata: deserializeMetadata(output),
1482
- };
1483
- break;
1150
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1484
1151
  case "ResourceNotFoundException":
1485
1152
  case "com.amazonaws.detective#ResourceNotFoundException":
1486
- response = {
1487
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1488
- name: errorCode,
1489
- $metadata: deserializeMetadata(output),
1490
- };
1491
- break;
1153
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1492
1154
  case "ValidationException":
1493
1155
  case "com.amazonaws.detective#ValidationException":
1494
- response = {
1495
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1496
- name: errorCode,
1497
- $metadata: deserializeMetadata(output),
1498
- };
1499
- break;
1156
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1500
1157
  default:
1501
1158
  const parsedBody = parsedOutput.body;
1502
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1503
- response = {
1504
- ...parsedBody,
1505
- name: `${errorCode}`,
1506
- message: parsedBody.message || parsedBody.Message || errorCode,
1159
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1160
+ name: parsedBody.code || parsedBody.Code || errorCode,
1507
1161
  $fault: "client",
1508
1162
  $metadata: deserializeMetadata(output),
1509
- };
1163
+ });
1164
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1510
1165
  }
1511
- const message = response.message || response.Message || errorCode;
1512
- response.message = message;
1513
- delete response.Message;
1514
- return Promise.reject(Object.assign(new Error(message), response));
1515
1166
  };
1516
1167
  const deserializeAws_restJson1StartMonitoringMemberCommand = async (output, context) => {
1517
1168
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1535,59 +1186,28 @@ const deserializeAws_restJson1StartMonitoringMemberCommandError = async (output,
1535
1186
  switch (errorCode) {
1536
1187
  case "ConflictException":
1537
1188
  case "com.amazonaws.detective#ConflictException":
1538
- response = {
1539
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
1540
- name: errorCode,
1541
- $metadata: deserializeMetadata(output),
1542
- };
1543
- break;
1189
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
1544
1190
  case "InternalServerException":
1545
1191
  case "com.amazonaws.detective#InternalServerException":
1546
- response = {
1547
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1548
- name: errorCode,
1549
- $metadata: deserializeMetadata(output),
1550
- };
1551
- break;
1192
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1552
1193
  case "ResourceNotFoundException":
1553
1194
  case "com.amazonaws.detective#ResourceNotFoundException":
1554
- response = {
1555
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1556
- name: errorCode,
1557
- $metadata: deserializeMetadata(output),
1558
- };
1559
- break;
1195
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1560
1196
  case "ServiceQuotaExceededException":
1561
1197
  case "com.amazonaws.detective#ServiceQuotaExceededException":
1562
- response = {
1563
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1564
- name: errorCode,
1565
- $metadata: deserializeMetadata(output),
1566
- };
1567
- break;
1198
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
1568
1199
  case "ValidationException":
1569
1200
  case "com.amazonaws.detective#ValidationException":
1570
- response = {
1571
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1572
- name: errorCode,
1573
- $metadata: deserializeMetadata(output),
1574
- };
1575
- break;
1201
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1576
1202
  default:
1577
1203
  const parsedBody = parsedOutput.body;
1578
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1579
- response = {
1580
- ...parsedBody,
1581
- name: `${errorCode}`,
1582
- message: parsedBody.message || parsedBody.Message || errorCode,
1204
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1205
+ name: parsedBody.code || parsedBody.Code || errorCode,
1583
1206
  $fault: "client",
1584
1207
  $metadata: deserializeMetadata(output),
1585
- };
1208
+ });
1209
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1586
1210
  }
1587
- const message = response.message || response.Message || errorCode;
1588
- response.message = message;
1589
- delete response.Message;
1590
- return Promise.reject(Object.assign(new Error(message), response));
1591
1211
  };
1592
1212
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1593
1213
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1611,43 +1231,22 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1611
1231
  switch (errorCode) {
1612
1232
  case "InternalServerException":
1613
1233
  case "com.amazonaws.detective#InternalServerException":
1614
- response = {
1615
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1616
- name: errorCode,
1617
- $metadata: deserializeMetadata(output),
1618
- };
1619
- break;
1234
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1620
1235
  case "ResourceNotFoundException":
1621
1236
  case "com.amazonaws.detective#ResourceNotFoundException":
1622
- response = {
1623
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1624
- name: errorCode,
1625
- $metadata: deserializeMetadata(output),
1626
- };
1627
- break;
1237
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1628
1238
  case "ValidationException":
1629
1239
  case "com.amazonaws.detective#ValidationException":
1630
- response = {
1631
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1632
- name: errorCode,
1633
- $metadata: deserializeMetadata(output),
1634
- };
1635
- break;
1240
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1636
1241
  default:
1637
1242
  const parsedBody = parsedOutput.body;
1638
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1639
- response = {
1640
- ...parsedBody,
1641
- name: `${errorCode}`,
1642
- message: parsedBody.message || parsedBody.Message || errorCode,
1243
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1244
+ name: parsedBody.code || parsedBody.Code || errorCode,
1643
1245
  $fault: "client",
1644
1246
  $metadata: deserializeMetadata(output),
1645
- };
1247
+ });
1248
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1646
1249
  }
1647
- const message = response.message || response.Message || errorCode;
1648
- response.message = message;
1649
- delete response.Message;
1650
- return Promise.reject(Object.assign(new Error(message), response));
1651
1250
  };
1652
1251
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1653
1252
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1671,43 +1270,22 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1671
1270
  switch (errorCode) {
1672
1271
  case "InternalServerException":
1673
1272
  case "com.amazonaws.detective#InternalServerException":
1674
- response = {
1675
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1676
- name: errorCode,
1677
- $metadata: deserializeMetadata(output),
1678
- };
1679
- break;
1273
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1680
1274
  case "ResourceNotFoundException":
1681
1275
  case "com.amazonaws.detective#ResourceNotFoundException":
1682
- response = {
1683
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1684
- name: errorCode,
1685
- $metadata: deserializeMetadata(output),
1686
- };
1687
- break;
1276
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1688
1277
  case "ValidationException":
1689
1278
  case "com.amazonaws.detective#ValidationException":
1690
- response = {
1691
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1692
- name: errorCode,
1693
- $metadata: deserializeMetadata(output),
1694
- };
1695
- break;
1279
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1696
1280
  default:
1697
1281
  const parsedBody = parsedOutput.body;
1698
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1699
- response = {
1700
- ...parsedBody,
1701
- name: `${errorCode}`,
1702
- message: parsedBody.message || parsedBody.Message || errorCode,
1282
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1283
+ name: parsedBody.code || parsedBody.Code || errorCode,
1703
1284
  $fault: "client",
1704
1285
  $metadata: deserializeMetadata(output),
1705
- };
1286
+ });
1287
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1706
1288
  }
1707
- const message = response.message || response.Message || errorCode;
1708
- response.message = message;
1709
- delete response.Message;
1710
- return Promise.reject(Object.assign(new Error(message), response));
1711
1289
  };
1712
1290
  const deserializeAws_restJson1UpdateOrganizationConfigurationCommand = async (output, context) => {
1713
1291
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1731,121 +1309,94 @@ const deserializeAws_restJson1UpdateOrganizationConfigurationCommandError = asyn
1731
1309
  switch (errorCode) {
1732
1310
  case "InternalServerException":
1733
1311
  case "com.amazonaws.detective#InternalServerException":
1734
- response = {
1735
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1736
- name: errorCode,
1737
- $metadata: deserializeMetadata(output),
1738
- };
1739
- break;
1312
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1740
1313
  case "TooManyRequestsException":
1741
1314
  case "com.amazonaws.detective#TooManyRequestsException":
1742
- response = {
1743
- ...(await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)),
1744
- name: errorCode,
1745
- $metadata: deserializeMetadata(output),
1746
- };
1747
- break;
1315
+ throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
1748
1316
  case "ValidationException":
1749
1317
  case "com.amazonaws.detective#ValidationException":
1750
- response = {
1751
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1752
- name: errorCode,
1753
- $metadata: deserializeMetadata(output),
1754
- };
1755
- break;
1318
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1756
1319
  default:
1757
1320
  const parsedBody = parsedOutput.body;
1758
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1759
- response = {
1760
- ...parsedBody,
1761
- name: `${errorCode}`,
1762
- message: parsedBody.message || parsedBody.Message || errorCode,
1321
+ response = new DetectiveServiceException_1.DetectiveServiceException({
1322
+ name: parsedBody.code || parsedBody.Code || errorCode,
1763
1323
  $fault: "client",
1764
1324
  $metadata: deserializeMetadata(output),
1765
- };
1325
+ });
1326
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1766
1327
  }
1767
- const message = response.message || response.Message || errorCode;
1768
- response.message = message;
1769
- delete response.Message;
1770
- return Promise.reject(Object.assign(new Error(message), response));
1771
1328
  };
1772
1329
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1773
- const contents = {
1774
- name: "ConflictException",
1775
- $fault: "client",
1776
- $metadata: deserializeMetadata(parsedOutput),
1777
- Message: undefined,
1778
- };
1330
+ const contents = {};
1779
1331
  const data = parsedOutput.body;
1780
1332
  if (data.Message !== undefined && data.Message !== null) {
1781
1333
  contents.Message = smithy_client_1.expectString(data.Message);
1782
1334
  }
1783
- return contents;
1335
+ const exception = new models_0_1.ConflictException({
1336
+ $metadata: deserializeMetadata(parsedOutput),
1337
+ ...contents,
1338
+ });
1339
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1784
1340
  };
1785
1341
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1786
- const contents = {
1787
- name: "InternalServerException",
1788
- $fault: "server",
1789
- $metadata: deserializeMetadata(parsedOutput),
1790
- Message: undefined,
1791
- };
1342
+ const contents = {};
1792
1343
  const data = parsedOutput.body;
1793
1344
  if (data.Message !== undefined && data.Message !== null) {
1794
1345
  contents.Message = smithy_client_1.expectString(data.Message);
1795
1346
  }
1796
- return contents;
1347
+ const exception = new models_0_1.InternalServerException({
1348
+ $metadata: deserializeMetadata(parsedOutput),
1349
+ ...contents,
1350
+ });
1351
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1797
1352
  };
1798
1353
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1799
- const contents = {
1800
- name: "ResourceNotFoundException",
1801
- $fault: "client",
1802
- $metadata: deserializeMetadata(parsedOutput),
1803
- Message: undefined,
1804
- };
1354
+ const contents = {};
1805
1355
  const data = parsedOutput.body;
1806
1356
  if (data.Message !== undefined && data.Message !== null) {
1807
1357
  contents.Message = smithy_client_1.expectString(data.Message);
1808
1358
  }
1809
- return contents;
1359
+ const exception = new models_0_1.ResourceNotFoundException({
1360
+ $metadata: deserializeMetadata(parsedOutput),
1361
+ ...contents,
1362
+ });
1363
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1810
1364
  };
1811
1365
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
1812
- const contents = {
1813
- name: "ServiceQuotaExceededException",
1814
- $fault: "client",
1815
- $metadata: deserializeMetadata(parsedOutput),
1816
- Message: undefined,
1817
- };
1366
+ const contents = {};
1818
1367
  const data = parsedOutput.body;
1819
1368
  if (data.Message !== undefined && data.Message !== null) {
1820
1369
  contents.Message = smithy_client_1.expectString(data.Message);
1821
1370
  }
1822
- return contents;
1371
+ const exception = new models_0_1.ServiceQuotaExceededException({
1372
+ $metadata: deserializeMetadata(parsedOutput),
1373
+ ...contents,
1374
+ });
1375
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1823
1376
  };
1824
1377
  const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
1825
- const contents = {
1826
- name: "TooManyRequestsException",
1827
- $fault: "client",
1828
- $metadata: deserializeMetadata(parsedOutput),
1829
- Message: undefined,
1830
- };
1378
+ const contents = {};
1831
1379
  const data = parsedOutput.body;
1832
1380
  if (data.Message !== undefined && data.Message !== null) {
1833
1381
  contents.Message = smithy_client_1.expectString(data.Message);
1834
1382
  }
1835
- return contents;
1383
+ const exception = new models_0_1.TooManyRequestsException({
1384
+ $metadata: deserializeMetadata(parsedOutput),
1385
+ ...contents,
1386
+ });
1387
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1836
1388
  };
1837
1389
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1838
- const contents = {
1839
- name: "ValidationException",
1840
- $fault: "client",
1841
- $metadata: deserializeMetadata(parsedOutput),
1842
- Message: undefined,
1843
- };
1390
+ const contents = {};
1844
1391
  const data = parsedOutput.body;
1845
1392
  if (data.Message !== undefined && data.Message !== null) {
1846
1393
  contents.Message = smithy_client_1.expectString(data.Message);
1847
1394
  }
1848
- return contents;
1395
+ const exception = new models_0_1.ValidationException({
1396
+ $metadata: deserializeMetadata(parsedOutput),
1397
+ ...contents,
1398
+ });
1399
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1849
1400
  };
1850
1401
  const serializeAws_restJson1Account = (input, context) => {
1851
1402
  return {
@@ -1885,7 +1436,7 @@ const serializeAws_restJson1TagMap = (input, context) => {
1885
1436
  }, {});
1886
1437
  };
1887
1438
  const deserializeAws_restJson1AccountIdList = (output, context) => {
1888
- return (output || [])
1439
+ const retVal = (output || [])
1889
1440
  .filter((e) => e != null)
1890
1441
  .map((entry) => {
1891
1442
  if (entry === null) {
@@ -1893,6 +1444,7 @@ const deserializeAws_restJson1AccountIdList = (output, context) => {
1893
1444
  }
1894
1445
  return smithy_client_1.expectString(entry);
1895
1446
  });
1447
+ return retVal;
1896
1448
  };
1897
1449
  const deserializeAws_restJson1Administrator = (output, context) => {
1898
1450
  return {
@@ -1904,7 +1456,7 @@ const deserializeAws_restJson1Administrator = (output, context) => {
1904
1456
  };
1905
1457
  };
1906
1458
  const deserializeAws_restJson1AdministratorList = (output, context) => {
1907
- return (output || [])
1459
+ const retVal = (output || [])
1908
1460
  .filter((e) => e != null)
1909
1461
  .map((entry) => {
1910
1462
  if (entry === null) {
@@ -1912,6 +1464,7 @@ const deserializeAws_restJson1AdministratorList = (output, context) => {
1912
1464
  }
1913
1465
  return deserializeAws_restJson1Administrator(entry, context);
1914
1466
  });
1467
+ return retVal;
1915
1468
  };
1916
1469
  const deserializeAws_restJson1Graph = (output, context) => {
1917
1470
  return {
@@ -1922,7 +1475,7 @@ const deserializeAws_restJson1Graph = (output, context) => {
1922
1475
  };
1923
1476
  };
1924
1477
  const deserializeAws_restJson1GraphList = (output, context) => {
1925
- return (output || [])
1478
+ const retVal = (output || [])
1926
1479
  .filter((e) => e != null)
1927
1480
  .map((entry) => {
1928
1481
  if (entry === null) {
@@ -1930,6 +1483,7 @@ const deserializeAws_restJson1GraphList = (output, context) => {
1930
1483
  }
1931
1484
  return deserializeAws_restJson1Graph(entry, context);
1932
1485
  });
1486
+ return retVal;
1933
1487
  };
1934
1488
  const deserializeAws_restJson1MemberDetail = (output, context) => {
1935
1489
  return {
@@ -1958,7 +1512,7 @@ const deserializeAws_restJson1MemberDetail = (output, context) => {
1958
1512
  };
1959
1513
  };
1960
1514
  const deserializeAws_restJson1MemberDetailList = (output, context) => {
1961
- return (output || [])
1515
+ const retVal = (output || [])
1962
1516
  .filter((e) => e != null)
1963
1517
  .map((entry) => {
1964
1518
  if (entry === null) {
@@ -1966,6 +1520,7 @@ const deserializeAws_restJson1MemberDetailList = (output, context) => {
1966
1520
  }
1967
1521
  return deserializeAws_restJson1MemberDetail(entry, context);
1968
1522
  });
1523
+ return retVal;
1969
1524
  };
1970
1525
  const deserializeAws_restJson1TagMap = (output, context) => {
1971
1526
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -1985,7 +1540,7 @@ const deserializeAws_restJson1UnprocessedAccount = (output, context) => {
1985
1540
  };
1986
1541
  };
1987
1542
  const deserializeAws_restJson1UnprocessedAccountList = (output, context) => {
1988
- return (output || [])
1543
+ const retVal = (output || [])
1989
1544
  .filter((e) => e != null)
1990
1545
  .map((entry) => {
1991
1546
  if (entry === null) {
@@ -1993,6 +1548,7 @@ const deserializeAws_restJson1UnprocessedAccountList = (output, context) => {
1993
1548
  }
1994
1549
  return deserializeAws_restJson1UnprocessedAccount(entry, context);
1995
1550
  });
1551
+ return retVal;
1996
1552
  };
1997
1553
  const deserializeMetadata = (output) => {
1998
1554
  var _a;