@aws-sdk/client-lex-runtime-v2 3.52.0 → 3.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_restJson1StartConversationCommand = exports.deserializeAws_restJson1RecognizeUtteranceCommand = exports.deserializeAws_restJson1RecognizeTextCommand = exports.deserializeAws_restJson1PutSessionCommand = exports.deserializeAws_restJson1GetSessionCommand = exports.deserializeAws_restJson1DeleteSessionCommand = exports.serializeAws_restJson1StartConversationCommand = exports.serializeAws_restJson1RecognizeUtteranceCommand = exports.serializeAws_restJson1RecognizeTextCommand = exports.serializeAws_restJson1PutSessionCommand = exports.serializeAws_restJson1GetSessionCommand = exports.serializeAws_restJson1DeleteSessionCommand = 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 LexRuntimeV2ServiceException_1 = require("../models/LexRuntimeV2ServiceException");
6
7
  const models_0_1 = require("../models/models_0");
7
8
  const serializeAws_restJson1DeleteSessionCommand = async (input, context) => {
8
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -429,67 +430,31 @@ const deserializeAws_restJson1DeleteSessionCommandError = async (output, context
429
430
  switch (errorCode) {
430
431
  case "AccessDeniedException":
431
432
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
432
- response = {
433
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
434
- name: errorCode,
435
- $metadata: deserializeMetadata(output),
436
- };
437
- break;
433
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
438
434
  case "ConflictException":
439
435
  case "com.amazonaws.lexruntimev2#ConflictException":
440
- response = {
441
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
442
- name: errorCode,
443
- $metadata: deserializeMetadata(output),
444
- };
445
- break;
436
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
446
437
  case "InternalServerException":
447
438
  case "com.amazonaws.lexruntimev2#InternalServerException":
448
- response = {
449
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
450
- name: errorCode,
451
- $metadata: deserializeMetadata(output),
452
- };
453
- break;
439
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
454
440
  case "ResourceNotFoundException":
455
441
  case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
456
- response = {
457
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
458
- name: errorCode,
459
- $metadata: deserializeMetadata(output),
460
- };
461
- break;
442
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
462
443
  case "ThrottlingException":
463
444
  case "com.amazonaws.lexruntimev2#ThrottlingException":
464
- response = {
465
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
466
- name: errorCode,
467
- $metadata: deserializeMetadata(output),
468
- };
469
- break;
445
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
470
446
  case "ValidationException":
471
447
  case "com.amazonaws.lexruntimev2#ValidationException":
472
- response = {
473
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
474
- name: errorCode,
475
- $metadata: deserializeMetadata(output),
476
- };
477
- break;
448
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
478
449
  default:
479
450
  const parsedBody = parsedOutput.body;
480
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
481
- response = {
482
- ...parsedBody,
483
- name: `${errorCode}`,
484
- message: parsedBody.message || parsedBody.Message || errorCode,
451
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
452
+ name: parsedBody.code || parsedBody.Code || errorCode,
485
453
  $fault: "client",
486
454
  $metadata: deserializeMetadata(output),
487
- };
455
+ });
456
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
488
457
  }
489
- const message = response.message || response.Message || errorCode;
490
- response.message = message;
491
- delete response.Message;
492
- return Promise.reject(Object.assign(new Error(message), response));
493
458
  };
494
459
  const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
495
460
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -529,59 +494,28 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
529
494
  switch (errorCode) {
530
495
  case "AccessDeniedException":
531
496
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
532
- response = {
533
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
534
- name: errorCode,
535
- $metadata: deserializeMetadata(output),
536
- };
537
- break;
497
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
538
498
  case "InternalServerException":
539
499
  case "com.amazonaws.lexruntimev2#InternalServerException":
540
- response = {
541
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
542
- name: errorCode,
543
- $metadata: deserializeMetadata(output),
544
- };
545
- break;
500
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
546
501
  case "ResourceNotFoundException":
547
502
  case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
548
- response = {
549
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
550
- name: errorCode,
551
- $metadata: deserializeMetadata(output),
552
- };
553
- break;
503
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
554
504
  case "ThrottlingException":
555
505
  case "com.amazonaws.lexruntimev2#ThrottlingException":
556
- response = {
557
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
558
- name: errorCode,
559
- $metadata: deserializeMetadata(output),
560
- };
561
- break;
506
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
562
507
  case "ValidationException":
563
508
  case "com.amazonaws.lexruntimev2#ValidationException":
564
- response = {
565
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
566
- name: errorCode,
567
- $metadata: deserializeMetadata(output),
568
- };
569
- break;
509
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
570
510
  default:
571
511
  const parsedBody = parsedOutput.body;
572
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
573
- response = {
574
- ...parsedBody,
575
- name: `${errorCode}`,
576
- message: parsedBody.message || parsedBody.Message || errorCode,
512
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
513
+ name: parsedBody.code || parsedBody.Code || errorCode,
577
514
  $fault: "client",
578
515
  $metadata: deserializeMetadata(output),
579
- };
516
+ });
517
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
580
518
  }
581
- const message = response.message || response.Message || errorCode;
582
- response.message = message;
583
- delete response.Message;
584
- return Promise.reject(Object.assign(new Error(message), response));
585
519
  };
586
520
  const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
587
521
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -627,83 +561,37 @@ const deserializeAws_restJson1PutSessionCommandError = async (output, context) =
627
561
  switch (errorCode) {
628
562
  case "AccessDeniedException":
629
563
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
630
- response = {
631
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
632
- name: errorCode,
633
- $metadata: deserializeMetadata(output),
634
- };
635
- break;
564
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
636
565
  case "BadGatewayException":
637
566
  case "com.amazonaws.lexruntimev2#BadGatewayException":
638
- response = {
639
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
640
- name: errorCode,
641
- $metadata: deserializeMetadata(output),
642
- };
643
- break;
567
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
644
568
  case "ConflictException":
645
569
  case "com.amazonaws.lexruntimev2#ConflictException":
646
- response = {
647
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
648
- name: errorCode,
649
- $metadata: deserializeMetadata(output),
650
- };
651
- break;
570
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
652
571
  case "DependencyFailedException":
653
572
  case "com.amazonaws.lexruntimev2#DependencyFailedException":
654
- response = {
655
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
656
- name: errorCode,
657
- $metadata: deserializeMetadata(output),
658
- };
659
- break;
573
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
660
574
  case "InternalServerException":
661
575
  case "com.amazonaws.lexruntimev2#InternalServerException":
662
- response = {
663
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
664
- name: errorCode,
665
- $metadata: deserializeMetadata(output),
666
- };
667
- break;
576
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
668
577
  case "ResourceNotFoundException":
669
578
  case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
670
- response = {
671
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
672
- name: errorCode,
673
- $metadata: deserializeMetadata(output),
674
- };
675
- break;
579
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
676
580
  case "ThrottlingException":
677
581
  case "com.amazonaws.lexruntimev2#ThrottlingException":
678
- response = {
679
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
680
- name: errorCode,
681
- $metadata: deserializeMetadata(output),
682
- };
683
- break;
582
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
684
583
  case "ValidationException":
685
584
  case "com.amazonaws.lexruntimev2#ValidationException":
686
- response = {
687
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
688
- name: errorCode,
689
- $metadata: deserializeMetadata(output),
690
- };
691
- break;
585
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
692
586
  default:
693
587
  const parsedBody = parsedOutput.body;
694
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
695
- response = {
696
- ...parsedBody,
697
- name: `${errorCode}`,
698
- message: parsedBody.message || parsedBody.Message || errorCode,
588
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
589
+ name: parsedBody.code || parsedBody.Code || errorCode,
699
590
  $fault: "client",
700
591
  $metadata: deserializeMetadata(output),
701
- };
592
+ });
593
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
702
594
  }
703
- const message = response.message || response.Message || errorCode;
704
- response.message = message;
705
- delete response.Message;
706
- return Promise.reject(Object.assign(new Error(message), response));
707
595
  };
708
596
  const deserializeAws_restJson1RecognizeTextCommand = async (output, context) => {
709
597
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -747,83 +635,37 @@ const deserializeAws_restJson1RecognizeTextCommandError = async (output, context
747
635
  switch (errorCode) {
748
636
  case "AccessDeniedException":
749
637
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
750
- response = {
751
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
752
- name: errorCode,
753
- $metadata: deserializeMetadata(output),
754
- };
755
- break;
638
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
756
639
  case "BadGatewayException":
757
640
  case "com.amazonaws.lexruntimev2#BadGatewayException":
758
- response = {
759
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
760
- name: errorCode,
761
- $metadata: deserializeMetadata(output),
762
- };
763
- break;
641
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
764
642
  case "ConflictException":
765
643
  case "com.amazonaws.lexruntimev2#ConflictException":
766
- response = {
767
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
768
- name: errorCode,
769
- $metadata: deserializeMetadata(output),
770
- };
771
- break;
644
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
772
645
  case "DependencyFailedException":
773
646
  case "com.amazonaws.lexruntimev2#DependencyFailedException":
774
- response = {
775
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
776
- name: errorCode,
777
- $metadata: deserializeMetadata(output),
778
- };
779
- break;
647
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
780
648
  case "InternalServerException":
781
649
  case "com.amazonaws.lexruntimev2#InternalServerException":
782
- response = {
783
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
784
- name: errorCode,
785
- $metadata: deserializeMetadata(output),
786
- };
787
- break;
650
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
788
651
  case "ResourceNotFoundException":
789
652
  case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
790
- response = {
791
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
792
- name: errorCode,
793
- $metadata: deserializeMetadata(output),
794
- };
795
- break;
653
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
796
654
  case "ThrottlingException":
797
655
  case "com.amazonaws.lexruntimev2#ThrottlingException":
798
- response = {
799
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
800
- name: errorCode,
801
- $metadata: deserializeMetadata(output),
802
- };
803
- break;
656
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
804
657
  case "ValidationException":
805
658
  case "com.amazonaws.lexruntimev2#ValidationException":
806
- response = {
807
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
808
- name: errorCode,
809
- $metadata: deserializeMetadata(output),
810
- };
811
- break;
659
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
812
660
  default:
813
661
  const parsedBody = parsedOutput.body;
814
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
815
- response = {
816
- ...parsedBody,
817
- name: `${errorCode}`,
818
- message: parsedBody.message || parsedBody.Message || errorCode,
662
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
663
+ name: parsedBody.code || parsedBody.Code || errorCode,
819
664
  $fault: "client",
820
665
  $metadata: deserializeMetadata(output),
821
- };
666
+ });
667
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
822
668
  }
823
- const message = response.message || response.Message || errorCode;
824
- response.message = message;
825
- delete response.Message;
826
- return Promise.reject(Object.assign(new Error(message), response));
827
669
  };
828
670
  const deserializeAws_restJson1RecognizeUtteranceCommand = async (output, context) => {
829
671
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -881,83 +723,37 @@ const deserializeAws_restJson1RecognizeUtteranceCommandError = async (output, co
881
723
  switch (errorCode) {
882
724
  case "AccessDeniedException":
883
725
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
884
- response = {
885
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
886
- name: errorCode,
887
- $metadata: deserializeMetadata(output),
888
- };
889
- break;
726
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
890
727
  case "BadGatewayException":
891
728
  case "com.amazonaws.lexruntimev2#BadGatewayException":
892
- response = {
893
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
894
- name: errorCode,
895
- $metadata: deserializeMetadata(output),
896
- };
897
- break;
729
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
898
730
  case "ConflictException":
899
731
  case "com.amazonaws.lexruntimev2#ConflictException":
900
- response = {
901
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
902
- name: errorCode,
903
- $metadata: deserializeMetadata(output),
904
- };
905
- break;
732
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
906
733
  case "DependencyFailedException":
907
734
  case "com.amazonaws.lexruntimev2#DependencyFailedException":
908
- response = {
909
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
910
- name: errorCode,
911
- $metadata: deserializeMetadata(output),
912
- };
913
- break;
735
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
914
736
  case "InternalServerException":
915
737
  case "com.amazonaws.lexruntimev2#InternalServerException":
916
- response = {
917
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
918
- name: errorCode,
919
- $metadata: deserializeMetadata(output),
920
- };
921
- break;
738
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
922
739
  case "ResourceNotFoundException":
923
740
  case "com.amazonaws.lexruntimev2#ResourceNotFoundException":
924
- response = {
925
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
926
- name: errorCode,
927
- $metadata: deserializeMetadata(output),
928
- };
929
- break;
741
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
930
742
  case "ThrottlingException":
931
743
  case "com.amazonaws.lexruntimev2#ThrottlingException":
932
- response = {
933
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
934
- name: errorCode,
935
- $metadata: deserializeMetadata(output),
936
- };
937
- break;
744
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
938
745
  case "ValidationException":
939
746
  case "com.amazonaws.lexruntimev2#ValidationException":
940
- response = {
941
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
942
- name: errorCode,
943
- $metadata: deserializeMetadata(output),
944
- };
945
- break;
747
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
946
748
  default:
947
749
  const parsedBody = parsedOutput.body;
948
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
949
- response = {
950
- ...parsedBody,
951
- name: `${errorCode}`,
952
- message: parsedBody.message || parsedBody.Message || errorCode,
750
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
751
+ name: parsedBody.code || parsedBody.Code || errorCode,
953
752
  $fault: "client",
954
753
  $metadata: deserializeMetadata(output),
955
- };
754
+ });
755
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
956
756
  }
957
- const message = response.message || response.Message || errorCode;
958
- response.message = message;
959
- delete response.Message;
960
- return Promise.reject(Object.assign(new Error(message), response));
961
757
  };
962
758
  const deserializeAws_restJson1StartConversationCommand = async (output, context) => {
963
759
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -997,51 +793,25 @@ const deserializeAws_restJson1StartConversationCommandError = async (output, con
997
793
  switch (errorCode) {
998
794
  case "AccessDeniedException":
999
795
  case "com.amazonaws.lexruntimev2#AccessDeniedException":
1000
- response = {
1001
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1002
- name: errorCode,
1003
- $metadata: deserializeMetadata(output),
1004
- };
1005
- break;
796
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1006
797
  case "InternalServerException":
1007
798
  case "com.amazonaws.lexruntimev2#InternalServerException":
1008
- response = {
1009
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1010
- name: errorCode,
1011
- $metadata: deserializeMetadata(output),
1012
- };
1013
- break;
799
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1014
800
  case "ThrottlingException":
1015
801
  case "com.amazonaws.lexruntimev2#ThrottlingException":
1016
- response = {
1017
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1018
- name: errorCode,
1019
- $metadata: deserializeMetadata(output),
1020
- };
1021
- break;
802
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1022
803
  case "ValidationException":
1023
804
  case "com.amazonaws.lexruntimev2#ValidationException":
1024
- response = {
1025
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1026
- name: errorCode,
1027
- $metadata: deserializeMetadata(output),
1028
- };
1029
- break;
805
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1030
806
  default:
1031
807
  const parsedBody = parsedOutput.body;
1032
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1033
- response = {
1034
- ...parsedBody,
1035
- name: `${errorCode}`,
1036
- message: parsedBody.message || parsedBody.Message || errorCode,
808
+ response = new LexRuntimeV2ServiceException_1.LexRuntimeV2ServiceException({
809
+ name: parsedBody.code || parsedBody.Code || errorCode,
1037
810
  $fault: "client",
1038
811
  $metadata: deserializeMetadata(output),
1039
- };
812
+ });
813
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1040
814
  }
1041
- const message = response.message || response.Message || errorCode;
1042
- response.message = message;
1043
- delete response.Message;
1044
- return Promise.reject(Object.assign(new Error(message), response));
1045
815
  };
1046
816
  const serializeAws_restJson1StartConversationRequestEventStream_event = (input, context) => {
1047
817
  return models_0_1.StartConversationRequestEventStream.visit(input, {
@@ -1304,108 +1074,100 @@ const deserializeAws_restJson1ValidationException_event = async (output, context
1304
1074
  return deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1305
1075
  };
1306
1076
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1307
- const contents = {
1308
- name: "AccessDeniedException",
1309
- $fault: "client",
1310
- $metadata: deserializeMetadata(parsedOutput),
1311
- message: undefined,
1312
- };
1077
+ const contents = {};
1313
1078
  const data = parsedOutput.body;
1314
1079
  if (data.message !== undefined && data.message !== null) {
1315
1080
  contents.message = smithy_client_1.expectString(data.message);
1316
1081
  }
1317
- return contents;
1082
+ const exception = new models_0_1.AccessDeniedException({
1083
+ $metadata: deserializeMetadata(parsedOutput),
1084
+ ...contents,
1085
+ });
1086
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1318
1087
  };
1319
1088
  const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
1320
- const contents = {
1321
- name: "BadGatewayException",
1322
- $fault: "server",
1323
- $metadata: deserializeMetadata(parsedOutput),
1324
- message: undefined,
1325
- };
1089
+ const contents = {};
1326
1090
  const data = parsedOutput.body;
1327
1091
  if (data.message !== undefined && data.message !== null) {
1328
1092
  contents.message = smithy_client_1.expectString(data.message);
1329
1093
  }
1330
- return contents;
1094
+ const exception = new models_0_1.BadGatewayException({
1095
+ $metadata: deserializeMetadata(parsedOutput),
1096
+ ...contents,
1097
+ });
1098
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1331
1099
  };
1332
1100
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1333
- const contents = {
1334
- name: "ConflictException",
1335
- $fault: "client",
1336
- $metadata: deserializeMetadata(parsedOutput),
1337
- message: undefined,
1338
- };
1101
+ const contents = {};
1339
1102
  const data = parsedOutput.body;
1340
1103
  if (data.message !== undefined && data.message !== null) {
1341
1104
  contents.message = smithy_client_1.expectString(data.message);
1342
1105
  }
1343
- return contents;
1106
+ const exception = new models_0_1.ConflictException({
1107
+ $metadata: deserializeMetadata(parsedOutput),
1108
+ ...contents,
1109
+ });
1110
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1344
1111
  };
1345
1112
  const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
1346
- const contents = {
1347
- name: "DependencyFailedException",
1348
- $fault: "client",
1349
- $metadata: deserializeMetadata(parsedOutput),
1350
- message: undefined,
1351
- };
1113
+ const contents = {};
1352
1114
  const data = parsedOutput.body;
1353
1115
  if (data.message !== undefined && data.message !== null) {
1354
1116
  contents.message = smithy_client_1.expectString(data.message);
1355
1117
  }
1356
- return contents;
1118
+ const exception = new models_0_1.DependencyFailedException({
1119
+ $metadata: deserializeMetadata(parsedOutput),
1120
+ ...contents,
1121
+ });
1122
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1357
1123
  };
1358
1124
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
1359
- const contents = {
1360
- name: "InternalServerException",
1361
- $fault: "server",
1362
- $metadata: deserializeMetadata(parsedOutput),
1363
- message: undefined,
1364
- };
1125
+ const contents = {};
1365
1126
  const data = parsedOutput.body;
1366
1127
  if (data.message !== undefined && data.message !== null) {
1367
1128
  contents.message = smithy_client_1.expectString(data.message);
1368
1129
  }
1369
- return contents;
1130
+ const exception = new models_0_1.InternalServerException({
1131
+ $metadata: deserializeMetadata(parsedOutput),
1132
+ ...contents,
1133
+ });
1134
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1370
1135
  };
1371
1136
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1372
- const contents = {
1373
- name: "ResourceNotFoundException",
1374
- $fault: "client",
1375
- $metadata: deserializeMetadata(parsedOutput),
1376
- message: undefined,
1377
- };
1137
+ const contents = {};
1378
1138
  const data = parsedOutput.body;
1379
1139
  if (data.message !== undefined && data.message !== null) {
1380
1140
  contents.message = smithy_client_1.expectString(data.message);
1381
1141
  }
1382
- return contents;
1142
+ const exception = new models_0_1.ResourceNotFoundException({
1143
+ $metadata: deserializeMetadata(parsedOutput),
1144
+ ...contents,
1145
+ });
1146
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1383
1147
  };
1384
1148
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
1385
- const contents = {
1386
- name: "ThrottlingException",
1387
- $fault: "client",
1388
- $metadata: deserializeMetadata(parsedOutput),
1389
- message: undefined,
1390
- };
1149
+ const contents = {};
1391
1150
  const data = parsedOutput.body;
1392
1151
  if (data.message !== undefined && data.message !== null) {
1393
1152
  contents.message = smithy_client_1.expectString(data.message);
1394
1153
  }
1395
- return contents;
1154
+ const exception = new models_0_1.ThrottlingException({
1155
+ $metadata: deserializeMetadata(parsedOutput),
1156
+ ...contents,
1157
+ });
1158
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1396
1159
  };
1397
1160
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
1398
- const contents = {
1399
- name: "ValidationException",
1400
- $fault: "client",
1401
- $metadata: deserializeMetadata(parsedOutput),
1402
- message: undefined,
1403
- };
1161
+ const contents = {};
1404
1162
  const data = parsedOutput.body;
1405
1163
  if (data.message !== undefined && data.message !== null) {
1406
1164
  contents.message = smithy_client_1.expectString(data.message);
1407
1165
  }
1408
- return contents;
1166
+ const exception = new models_0_1.ValidationException({
1167
+ $metadata: deserializeMetadata(parsedOutput),
1168
+ ...contents,
1169
+ });
1170
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1409
1171
  };
1410
1172
  const serializeAws_restJson1ActiveContext = (input, context) => {
1411
1173
  return {
@@ -1747,7 +1509,7 @@ const deserializeAws_restJson1ActiveContextParametersMap = (output, context) =>
1747
1509
  }, {});
1748
1510
  };
1749
1511
  const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1750
- return (output || [])
1512
+ const retVal = (output || [])
1751
1513
  .filter((e) => e != null)
1752
1514
  .map((entry) => {
1753
1515
  if (entry === null) {
@@ -1755,6 +1517,7 @@ const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1755
1517
  }
1756
1518
  return deserializeAws_restJson1ActiveContext(entry, context);
1757
1519
  });
1520
+ return retVal;
1758
1521
  };
1759
1522
  const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
1760
1523
  return {
@@ -1783,7 +1546,7 @@ const deserializeAws_restJson1Button = (output, context) => {
1783
1546
  };
1784
1547
  };
1785
1548
  const deserializeAws_restJson1ButtonsList = (output, context) => {
1786
- return (output || [])
1549
+ const retVal = (output || [])
1787
1550
  .filter((e) => e != null)
1788
1551
  .map((entry) => {
1789
1552
  if (entry === null) {
@@ -1791,6 +1554,7 @@ const deserializeAws_restJson1ButtonsList = (output, context) => {
1791
1554
  }
1792
1555
  return deserializeAws_restJson1Button(entry, context);
1793
1556
  });
1557
+ return retVal;
1794
1558
  };
1795
1559
  const deserializeAws_restJson1ConfidenceScore = (output, context) => {
1796
1560
  return {
@@ -1874,7 +1638,7 @@ const deserializeAws_restJson1Interpretation = (output, context) => {
1874
1638
  };
1875
1639
  };
1876
1640
  const deserializeAws_restJson1Interpretations = (output, context) => {
1877
- return (output || [])
1641
+ const retVal = (output || [])
1878
1642
  .filter((e) => e != null)
1879
1643
  .map((entry) => {
1880
1644
  if (entry === null) {
@@ -1882,6 +1646,7 @@ const deserializeAws_restJson1Interpretations = (output, context) => {
1882
1646
  }
1883
1647
  return deserializeAws_restJson1Interpretation(entry, context);
1884
1648
  });
1649
+ return retVal;
1885
1650
  };
1886
1651
  const deserializeAws_restJson1Message = (output, context) => {
1887
1652
  return {
@@ -1893,7 +1658,7 @@ const deserializeAws_restJson1Message = (output, context) => {
1893
1658
  };
1894
1659
  };
1895
1660
  const deserializeAws_restJson1Messages = (output, context) => {
1896
- return (output || [])
1661
+ const retVal = (output || [])
1897
1662
  .filter((e) => e != null)
1898
1663
  .map((entry) => {
1899
1664
  if (entry === null) {
@@ -1901,6 +1666,7 @@ const deserializeAws_restJson1Messages = (output, context) => {
1901
1666
  }
1902
1667
  return deserializeAws_restJson1Message(entry, context);
1903
1668
  });
1669
+ return retVal;
1904
1670
  };
1905
1671
  const deserializeAws_restJson1PlaybackInterruptionEvent = (output, context) => {
1906
1672
  return {
@@ -1934,7 +1700,7 @@ const deserializeAws_restJson1RuntimeHintValue = (output, context) => {
1934
1700
  };
1935
1701
  };
1936
1702
  const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
1937
- return (output || [])
1703
+ const retVal = (output || [])
1938
1704
  .filter((e) => e != null)
1939
1705
  .map((entry) => {
1940
1706
  if (entry === null) {
@@ -1942,6 +1708,7 @@ const deserializeAws_restJson1RuntimeHintValuesList = (output, context) => {
1942
1708
  }
1943
1709
  return deserializeAws_restJson1RuntimeHintValue(entry, context);
1944
1710
  });
1711
+ return retVal;
1945
1712
  };
1946
1713
  const deserializeAws_restJson1SentimentResponse = (output, context) => {
1947
1714
  return {
@@ -2097,7 +1864,7 @@ const deserializeAws_restJson1StartConversationResponseEventStream = (output, co
2097
1864
  return { $unknown: Object.entries(output)[0] };
2098
1865
  };
2099
1866
  const deserializeAws_restJson1StringList = (output, context) => {
2100
- return (output || [])
1867
+ const retVal = (output || [])
2101
1868
  .filter((e) => e != null)
2102
1869
  .map((entry) => {
2103
1870
  if (entry === null) {
@@ -2105,6 +1872,7 @@ const deserializeAws_restJson1StringList = (output, context) => {
2105
1872
  }
2106
1873
  return smithy_client_1.expectString(entry);
2107
1874
  });
1875
+ return retVal;
2108
1876
  };
2109
1877
  const deserializeAws_restJson1StringMap = (output, context) => {
2110
1878
  return Object.entries(output).reduce((acc, [key, value]) => {
@@ -2151,7 +1919,7 @@ const deserializeAws_restJson1Value = (output, context) => {
2151
1919
  };
2152
1920
  };
2153
1921
  const deserializeAws_restJson1Values = (output, context) => {
2154
- return (output || [])
1922
+ const retVal = (output || [])
2155
1923
  .filter((e) => e != null)
2156
1924
  .map((entry) => {
2157
1925
  if (entry === null) {
@@ -2159,6 +1927,7 @@ const deserializeAws_restJson1Values = (output, context) => {
2159
1927
  }
2160
1928
  return deserializeAws_restJson1Slot(entry, context);
2161
1929
  });
1930
+ return retVal;
2162
1931
  };
2163
1932
  const deserializeMetadata = (output) => {
2164
1933
  var _a;