@aws-sdk/client-lex-runtime-service 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_restJson1PutSessionCommand = exports.deserializeAws_restJson1PostTextCommand = exports.deserializeAws_restJson1PostContentCommand = exports.deserializeAws_restJson1GetSessionCommand = exports.deserializeAws_restJson1DeleteSessionCommand = exports.serializeAws_restJson1PutSessionCommand = exports.serializeAws_restJson1PostTextCommand = exports.serializeAws_restJson1PostContentCommand = 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 LexRuntimeServiceServiceException_1 = require("../models/LexRuntimeServiceServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_restJson1DeleteSessionCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {};
@@ -333,59 +335,28 @@ const deserializeAws_restJson1DeleteSessionCommandError = async (output, context
333
335
  switch (errorCode) {
334
336
  case "BadRequestException":
335
337
  case "com.amazonaws.lexruntimeservice#BadRequestException":
336
- response = {
337
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
338
- name: errorCode,
339
- $metadata: deserializeMetadata(output),
340
- };
341
- break;
338
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
342
339
  case "ConflictException":
343
340
  case "com.amazonaws.lexruntimeservice#ConflictException":
344
- response = {
345
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
346
- name: errorCode,
347
- $metadata: deserializeMetadata(output),
348
- };
349
- break;
341
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
350
342
  case "InternalFailureException":
351
343
  case "com.amazonaws.lexruntimeservice#InternalFailureException":
352
- response = {
353
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
354
- name: errorCode,
355
- $metadata: deserializeMetadata(output),
356
- };
357
- break;
344
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
358
345
  case "LimitExceededException":
359
346
  case "com.amazonaws.lexruntimeservice#LimitExceededException":
360
- response = {
361
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
362
- name: errorCode,
363
- $metadata: deserializeMetadata(output),
364
- };
365
- break;
347
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
366
348
  case "NotFoundException":
367
349
  case "com.amazonaws.lexruntimeservice#NotFoundException":
368
- response = {
369
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
370
- name: errorCode,
371
- $metadata: deserializeMetadata(output),
372
- };
373
- break;
350
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
374
351
  default:
375
352
  const parsedBody = parsedOutput.body;
376
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
377
- response = {
378
- ...parsedBody,
379
- name: `${errorCode}`,
380
- message: parsedBody.message || parsedBody.Message || errorCode,
353
+ response = new LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException({
354
+ name: parsedBody.code || parsedBody.Code || errorCode,
381
355
  $fault: "client",
382
356
  $metadata: deserializeMetadata(output),
383
- };
357
+ });
358
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
384
359
  }
385
- const message = response.message || response.Message || errorCode;
386
- response.message = message;
387
- delete response.Message;
388
- return Promise.reject(Object.assign(new Error(message), response));
389
360
  };
390
361
  const deserializeAws_restJson1GetSessionCommand = async (output, context) => {
391
362
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -429,51 +400,25 @@ const deserializeAws_restJson1GetSessionCommandError = async (output, context) =
429
400
  switch (errorCode) {
430
401
  case "BadRequestException":
431
402
  case "com.amazonaws.lexruntimeservice#BadRequestException":
432
- response = {
433
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
434
- name: errorCode,
435
- $metadata: deserializeMetadata(output),
436
- };
437
- break;
403
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
438
404
  case "InternalFailureException":
439
405
  case "com.amazonaws.lexruntimeservice#InternalFailureException":
440
- response = {
441
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
442
- name: errorCode,
443
- $metadata: deserializeMetadata(output),
444
- };
445
- break;
406
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
446
407
  case "LimitExceededException":
447
408
  case "com.amazonaws.lexruntimeservice#LimitExceededException":
448
- response = {
449
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
450
- name: errorCode,
451
- $metadata: deserializeMetadata(output),
452
- };
453
- break;
409
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
454
410
  case "NotFoundException":
455
411
  case "com.amazonaws.lexruntimeservice#NotFoundException":
456
- response = {
457
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
458
- name: errorCode,
459
- $metadata: deserializeMetadata(output),
460
- };
461
- break;
412
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
462
413
  default:
463
414
  const parsedBody = parsedOutput.body;
464
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
465
- response = {
466
- ...parsedBody,
467
- name: `${errorCode}`,
468
- message: parsedBody.message || parsedBody.Message || errorCode,
415
+ response = new LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException({
416
+ name: parsedBody.code || parsedBody.Code || errorCode,
469
417
  $fault: "client",
470
418
  $metadata: deserializeMetadata(output),
471
- };
419
+ });
420
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
472
421
  }
473
- const message = response.message || response.Message || errorCode;
474
- response.message = message;
475
- delete response.Message;
476
- return Promise.reject(Object.assign(new Error(message), response));
477
422
  };
478
423
  const deserializeAws_restJson1PostContentCommand = async (output, context) => {
479
424
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -567,107 +512,46 @@ const deserializeAws_restJson1PostContentCommandError = async (output, context)
567
512
  switch (errorCode) {
568
513
  case "BadGatewayException":
569
514
  case "com.amazonaws.lexruntimeservice#BadGatewayException":
570
- response = {
571
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
572
- name: errorCode,
573
- $metadata: deserializeMetadata(output),
574
- };
575
- break;
515
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
576
516
  case "BadRequestException":
577
517
  case "com.amazonaws.lexruntimeservice#BadRequestException":
578
- response = {
579
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
580
- name: errorCode,
581
- $metadata: deserializeMetadata(output),
582
- };
583
- break;
518
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
584
519
  case "ConflictException":
585
520
  case "com.amazonaws.lexruntimeservice#ConflictException":
586
- response = {
587
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
588
- name: errorCode,
589
- $metadata: deserializeMetadata(output),
590
- };
591
- break;
521
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
592
522
  case "DependencyFailedException":
593
523
  case "com.amazonaws.lexruntimeservice#DependencyFailedException":
594
- response = {
595
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
596
- name: errorCode,
597
- $metadata: deserializeMetadata(output),
598
- };
599
- break;
524
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
600
525
  case "InternalFailureException":
601
526
  case "com.amazonaws.lexruntimeservice#InternalFailureException":
602
- response = {
603
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
604
- name: errorCode,
605
- $metadata: deserializeMetadata(output),
606
- };
607
- break;
527
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
608
528
  case "LimitExceededException":
609
529
  case "com.amazonaws.lexruntimeservice#LimitExceededException":
610
- response = {
611
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
612
- name: errorCode,
613
- $metadata: deserializeMetadata(output),
614
- };
615
- break;
530
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
616
531
  case "LoopDetectedException":
617
532
  case "com.amazonaws.lexruntimeservice#LoopDetectedException":
618
- response = {
619
- ...(await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context)),
620
- name: errorCode,
621
- $metadata: deserializeMetadata(output),
622
- };
623
- break;
533
+ throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
624
534
  case "NotAcceptableException":
625
535
  case "com.amazonaws.lexruntimeservice#NotAcceptableException":
626
- response = {
627
- ...(await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context)),
628
- name: errorCode,
629
- $metadata: deserializeMetadata(output),
630
- };
631
- break;
536
+ throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
632
537
  case "NotFoundException":
633
538
  case "com.amazonaws.lexruntimeservice#NotFoundException":
634
- response = {
635
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
636
- name: errorCode,
637
- $metadata: deserializeMetadata(output),
638
- };
639
- break;
539
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
640
540
  case "RequestTimeoutException":
641
541
  case "com.amazonaws.lexruntimeservice#RequestTimeoutException":
642
- response = {
643
- ...(await deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context)),
644
- name: errorCode,
645
- $metadata: deserializeMetadata(output),
646
- };
647
- break;
542
+ throw await deserializeAws_restJson1RequestTimeoutExceptionResponse(parsedOutput, context);
648
543
  case "UnsupportedMediaTypeException":
649
544
  case "com.amazonaws.lexruntimeservice#UnsupportedMediaTypeException":
650
- response = {
651
- ...(await deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context)),
652
- name: errorCode,
653
- $metadata: deserializeMetadata(output),
654
- };
655
- break;
545
+ throw await deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse(parsedOutput, context);
656
546
  default:
657
547
  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,
548
+ response = new LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException({
549
+ name: parsedBody.code || parsedBody.Code || errorCode,
663
550
  $fault: "client",
664
551
  $metadata: deserializeMetadata(output),
665
- };
552
+ });
553
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
666
554
  }
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
555
  };
672
556
  const deserializeAws_restJson1PostTextCommand = async (output, context) => {
673
557
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -747,83 +631,37 @@ const deserializeAws_restJson1PostTextCommandError = async (output, context) =>
747
631
  switch (errorCode) {
748
632
  case "BadGatewayException":
749
633
  case "com.amazonaws.lexruntimeservice#BadGatewayException":
750
- response = {
751
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
752
- name: errorCode,
753
- $metadata: deserializeMetadata(output),
754
- };
755
- break;
634
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
756
635
  case "BadRequestException":
757
636
  case "com.amazonaws.lexruntimeservice#BadRequestException":
758
- response = {
759
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
760
- name: errorCode,
761
- $metadata: deserializeMetadata(output),
762
- };
763
- break;
637
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
764
638
  case "ConflictException":
765
639
  case "com.amazonaws.lexruntimeservice#ConflictException":
766
- response = {
767
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
768
- name: errorCode,
769
- $metadata: deserializeMetadata(output),
770
- };
771
- break;
640
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
772
641
  case "DependencyFailedException":
773
642
  case "com.amazonaws.lexruntimeservice#DependencyFailedException":
774
- response = {
775
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
776
- name: errorCode,
777
- $metadata: deserializeMetadata(output),
778
- };
779
- break;
643
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
780
644
  case "InternalFailureException":
781
645
  case "com.amazonaws.lexruntimeservice#InternalFailureException":
782
- response = {
783
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
784
- name: errorCode,
785
- $metadata: deserializeMetadata(output),
786
- };
787
- break;
646
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
788
647
  case "LimitExceededException":
789
648
  case "com.amazonaws.lexruntimeservice#LimitExceededException":
790
- response = {
791
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
792
- name: errorCode,
793
- $metadata: deserializeMetadata(output),
794
- };
795
- break;
649
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
796
650
  case "LoopDetectedException":
797
651
  case "com.amazonaws.lexruntimeservice#LoopDetectedException":
798
- response = {
799
- ...(await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context)),
800
- name: errorCode,
801
- $metadata: deserializeMetadata(output),
802
- };
803
- break;
652
+ throw await deserializeAws_restJson1LoopDetectedExceptionResponse(parsedOutput, context);
804
653
  case "NotFoundException":
805
654
  case "com.amazonaws.lexruntimeservice#NotFoundException":
806
- response = {
807
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
808
- name: errorCode,
809
- $metadata: deserializeMetadata(output),
810
- };
811
- break;
655
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
812
656
  default:
813
657
  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,
658
+ response = new LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException({
659
+ name: parsedBody.code || parsedBody.Code || errorCode,
819
660
  $fault: "client",
820
661
  $metadata: deserializeMetadata(output),
821
- };
662
+ });
663
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
822
664
  }
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
665
  };
828
666
  const deserializeAws_restJson1PutSessionCommand = async (output, context) => {
829
667
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -893,157 +731,100 @@ const deserializeAws_restJson1PutSessionCommandError = async (output, context) =
893
731
  switch (errorCode) {
894
732
  case "BadGatewayException":
895
733
  case "com.amazonaws.lexruntimeservice#BadGatewayException":
896
- response = {
897
- ...(await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context)),
898
- name: errorCode,
899
- $metadata: deserializeMetadata(output),
900
- };
901
- break;
734
+ throw await deserializeAws_restJson1BadGatewayExceptionResponse(parsedOutput, context);
902
735
  case "BadRequestException":
903
736
  case "com.amazonaws.lexruntimeservice#BadRequestException":
904
- response = {
905
- ...(await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context)),
906
- name: errorCode,
907
- $metadata: deserializeMetadata(output),
908
- };
909
- break;
737
+ throw await deserializeAws_restJson1BadRequestExceptionResponse(parsedOutput, context);
910
738
  case "ConflictException":
911
739
  case "com.amazonaws.lexruntimeservice#ConflictException":
912
- response = {
913
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
914
- name: errorCode,
915
- $metadata: deserializeMetadata(output),
916
- };
917
- break;
740
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
918
741
  case "DependencyFailedException":
919
742
  case "com.amazonaws.lexruntimeservice#DependencyFailedException":
920
- response = {
921
- ...(await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context)),
922
- name: errorCode,
923
- $metadata: deserializeMetadata(output),
924
- };
925
- break;
743
+ throw await deserializeAws_restJson1DependencyFailedExceptionResponse(parsedOutput, context);
926
744
  case "InternalFailureException":
927
745
  case "com.amazonaws.lexruntimeservice#InternalFailureException":
928
- response = {
929
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
930
- name: errorCode,
931
- $metadata: deserializeMetadata(output),
932
- };
933
- break;
746
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
934
747
  case "LimitExceededException":
935
748
  case "com.amazonaws.lexruntimeservice#LimitExceededException":
936
- response = {
937
- ...(await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)),
938
- name: errorCode,
939
- $metadata: deserializeMetadata(output),
940
- };
941
- break;
749
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
942
750
  case "NotAcceptableException":
943
751
  case "com.amazonaws.lexruntimeservice#NotAcceptableException":
944
- response = {
945
- ...(await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context)),
946
- name: errorCode,
947
- $metadata: deserializeMetadata(output),
948
- };
949
- break;
752
+ throw await deserializeAws_restJson1NotAcceptableExceptionResponse(parsedOutput, context);
950
753
  case "NotFoundException":
951
754
  case "com.amazonaws.lexruntimeservice#NotFoundException":
952
- response = {
953
- ...(await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context)),
954
- name: errorCode,
955
- $metadata: deserializeMetadata(output),
956
- };
957
- break;
755
+ throw await deserializeAws_restJson1NotFoundExceptionResponse(parsedOutput, context);
958
756
  default:
959
757
  const parsedBody = parsedOutput.body;
960
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
961
- response = {
962
- ...parsedBody,
963
- name: `${errorCode}`,
964
- message: parsedBody.message || parsedBody.Message || errorCode,
758
+ response = new LexRuntimeServiceServiceException_1.LexRuntimeServiceServiceException({
759
+ name: parsedBody.code || parsedBody.Code || errorCode,
965
760
  $fault: "client",
966
761
  $metadata: deserializeMetadata(output),
967
- };
762
+ });
763
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
968
764
  }
969
- const message = response.message || response.Message || errorCode;
970
- response.message = message;
971
- delete response.Message;
972
- return Promise.reject(Object.assign(new Error(message), response));
973
765
  };
974
766
  const deserializeAws_restJson1BadGatewayExceptionResponse = async (parsedOutput, context) => {
975
- const contents = {
976
- name: "BadGatewayException",
977
- $fault: "server",
978
- $metadata: deserializeMetadata(parsedOutput),
979
- Message: undefined,
980
- };
767
+ const contents = {};
981
768
  const data = parsedOutput.body;
982
769
  if (data.Message !== undefined && data.Message !== null) {
983
770
  contents.Message = smithy_client_1.expectString(data.Message);
984
771
  }
985
- return contents;
772
+ const exception = new models_0_1.BadGatewayException({
773
+ $metadata: deserializeMetadata(parsedOutput),
774
+ ...contents,
775
+ });
776
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
986
777
  };
987
778
  const deserializeAws_restJson1BadRequestExceptionResponse = async (parsedOutput, context) => {
988
- const contents = {
989
- name: "BadRequestException",
990
- $fault: "client",
991
- $metadata: deserializeMetadata(parsedOutput),
992
- message: undefined,
993
- };
779
+ const contents = {};
994
780
  const data = parsedOutput.body;
995
781
  if (data.message !== undefined && data.message !== null) {
996
782
  contents.message = smithy_client_1.expectString(data.message);
997
783
  }
998
- return contents;
784
+ const exception = new models_0_1.BadRequestException({
785
+ $metadata: deserializeMetadata(parsedOutput),
786
+ ...contents,
787
+ });
788
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
999
789
  };
1000
790
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
1001
- const contents = {
1002
- name: "ConflictException",
1003
- $fault: "client",
1004
- $metadata: deserializeMetadata(parsedOutput),
1005
- message: undefined,
1006
- };
791
+ const contents = {};
1007
792
  const data = parsedOutput.body;
1008
793
  if (data.message !== undefined && data.message !== null) {
1009
794
  contents.message = smithy_client_1.expectString(data.message);
1010
795
  }
1011
- return contents;
796
+ const exception = new models_0_1.ConflictException({
797
+ $metadata: deserializeMetadata(parsedOutput),
798
+ ...contents,
799
+ });
800
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1012
801
  };
1013
802
  const deserializeAws_restJson1DependencyFailedExceptionResponse = async (parsedOutput, context) => {
1014
- const contents = {
1015
- name: "DependencyFailedException",
1016
- $fault: "client",
1017
- $metadata: deserializeMetadata(parsedOutput),
1018
- Message: undefined,
1019
- };
803
+ const contents = {};
1020
804
  const data = parsedOutput.body;
1021
805
  if (data.Message !== undefined && data.Message !== null) {
1022
806
  contents.Message = smithy_client_1.expectString(data.Message);
1023
807
  }
1024
- return contents;
808
+ const exception = new models_0_1.DependencyFailedException({
809
+ $metadata: deserializeMetadata(parsedOutput),
810
+ ...contents,
811
+ });
812
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1025
813
  };
1026
814
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
1027
- const contents = {
1028
- name: "InternalFailureException",
1029
- $fault: "server",
1030
- $metadata: deserializeMetadata(parsedOutput),
1031
- message: undefined,
1032
- };
815
+ const contents = {};
1033
816
  const data = parsedOutput.body;
1034
817
  if (data.message !== undefined && data.message !== null) {
1035
818
  contents.message = smithy_client_1.expectString(data.message);
1036
819
  }
1037
- return contents;
820
+ const exception = new models_0_1.InternalFailureException({
821
+ $metadata: deserializeMetadata(parsedOutput),
822
+ ...contents,
823
+ });
824
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1038
825
  };
1039
826
  const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
1040
- const contents = {
1041
- name: "LimitExceededException",
1042
- $fault: "client",
1043
- $metadata: deserializeMetadata(parsedOutput),
1044
- message: undefined,
1045
- retryAfterSeconds: undefined,
1046
- };
827
+ const contents = {};
1047
828
  if (parsedOutput.headers["retry-after"] !== undefined) {
1048
829
  contents.retryAfterSeconds = parsedOutput.headers["retry-after"];
1049
830
  }
@@ -1051,72 +832,71 @@ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutp
1051
832
  if (data.message !== undefined && data.message !== null) {
1052
833
  contents.message = smithy_client_1.expectString(data.message);
1053
834
  }
1054
- return contents;
835
+ const exception = new models_0_1.LimitExceededException({
836
+ $metadata: deserializeMetadata(parsedOutput),
837
+ ...contents,
838
+ });
839
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1055
840
  };
1056
841
  const deserializeAws_restJson1LoopDetectedExceptionResponse = async (parsedOutput, context) => {
1057
- const contents = {
1058
- name: "LoopDetectedException",
1059
- $fault: "server",
1060
- $metadata: deserializeMetadata(parsedOutput),
1061
- Message: undefined,
1062
- };
842
+ const contents = {};
1063
843
  const data = parsedOutput.body;
1064
844
  if (data.Message !== undefined && data.Message !== null) {
1065
845
  contents.Message = smithy_client_1.expectString(data.Message);
1066
846
  }
1067
- return contents;
847
+ const exception = new models_0_1.LoopDetectedException({
848
+ $metadata: deserializeMetadata(parsedOutput),
849
+ ...contents,
850
+ });
851
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1068
852
  };
1069
853
  const deserializeAws_restJson1NotAcceptableExceptionResponse = async (parsedOutput, context) => {
1070
- const contents = {
1071
- name: "NotAcceptableException",
1072
- $fault: "client",
1073
- $metadata: deserializeMetadata(parsedOutput),
1074
- message: undefined,
1075
- };
854
+ const contents = {};
1076
855
  const data = parsedOutput.body;
1077
856
  if (data.message !== undefined && data.message !== null) {
1078
857
  contents.message = smithy_client_1.expectString(data.message);
1079
858
  }
1080
- return contents;
859
+ const exception = new models_0_1.NotAcceptableException({
860
+ $metadata: deserializeMetadata(parsedOutput),
861
+ ...contents,
862
+ });
863
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1081
864
  };
1082
865
  const deserializeAws_restJson1NotFoundExceptionResponse = async (parsedOutput, context) => {
1083
- const contents = {
1084
- name: "NotFoundException",
1085
- $fault: "client",
1086
- $metadata: deserializeMetadata(parsedOutput),
1087
- message: undefined,
1088
- };
866
+ const contents = {};
1089
867
  const data = parsedOutput.body;
1090
868
  if (data.message !== undefined && data.message !== null) {
1091
869
  contents.message = smithy_client_1.expectString(data.message);
1092
870
  }
1093
- return contents;
871
+ const exception = new models_0_1.NotFoundException({
872
+ $metadata: deserializeMetadata(parsedOutput),
873
+ ...contents,
874
+ });
875
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1094
876
  };
1095
877
  const deserializeAws_restJson1RequestTimeoutExceptionResponse = async (parsedOutput, context) => {
1096
- const contents = {
1097
- name: "RequestTimeoutException",
1098
- $fault: "client",
1099
- $metadata: deserializeMetadata(parsedOutput),
1100
- message: undefined,
1101
- };
878
+ const contents = {};
1102
879
  const data = parsedOutput.body;
1103
880
  if (data.message !== undefined && data.message !== null) {
1104
881
  contents.message = smithy_client_1.expectString(data.message);
1105
882
  }
1106
- return contents;
883
+ const exception = new models_0_1.RequestTimeoutException({
884
+ $metadata: deserializeMetadata(parsedOutput),
885
+ ...contents,
886
+ });
887
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1107
888
  };
1108
889
  const deserializeAws_restJson1UnsupportedMediaTypeExceptionResponse = async (parsedOutput, context) => {
1109
- const contents = {
1110
- name: "UnsupportedMediaTypeException",
1111
- $fault: "client",
1112
- $metadata: deserializeMetadata(parsedOutput),
1113
- message: undefined,
1114
- };
890
+ const contents = {};
1115
891
  const data = parsedOutput.body;
1116
892
  if (data.message !== undefined && data.message !== null) {
1117
893
  contents.message = smithy_client_1.expectString(data.message);
1118
894
  }
1119
- return contents;
895
+ const exception = new models_0_1.UnsupportedMediaTypeException({
896
+ $metadata: deserializeMetadata(parsedOutput),
897
+ ...contents,
898
+ });
899
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1120
900
  };
1121
901
  const serializeAws_restJson1ActiveContext = (input, context) => {
1122
902
  return {
@@ -1232,7 +1012,7 @@ const deserializeAws_restJson1ActiveContextParametersMap = (output, context) =>
1232
1012
  }, {});
1233
1013
  };
1234
1014
  const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1235
- return (output || [])
1015
+ const retVal = (output || [])
1236
1016
  .filter((e) => e != null)
1237
1017
  .map((entry) => {
1238
1018
  if (entry === null) {
@@ -1240,6 +1020,7 @@ const deserializeAws_restJson1ActiveContextsList = (output, context) => {
1240
1020
  }
1241
1021
  return deserializeAws_restJson1ActiveContext(entry, context);
1242
1022
  });
1023
+ return retVal;
1243
1024
  };
1244
1025
  const deserializeAws_restJson1ActiveContextTimeToLive = (output, context) => {
1245
1026
  return {
@@ -1278,7 +1059,7 @@ const deserializeAws_restJson1GenericAttachment = (output, context) => {
1278
1059
  };
1279
1060
  };
1280
1061
  const deserializeAws_restJson1genericAttachmentList = (output, context) => {
1281
- return (output || [])
1062
+ const retVal = (output || [])
1282
1063
  .filter((e) => e != null)
1283
1064
  .map((entry) => {
1284
1065
  if (entry === null) {
@@ -1286,6 +1067,7 @@ const deserializeAws_restJson1genericAttachmentList = (output, context) => {
1286
1067
  }
1287
1068
  return deserializeAws_restJson1GenericAttachment(entry, context);
1288
1069
  });
1070
+ return retVal;
1289
1071
  };
1290
1072
  const deserializeAws_restJson1IntentConfidence = (output, context) => {
1291
1073
  return {
@@ -1293,7 +1075,7 @@ const deserializeAws_restJson1IntentConfidence = (output, context) => {
1293
1075
  };
1294
1076
  };
1295
1077
  const deserializeAws_restJson1IntentList = (output, context) => {
1296
- return (output || [])
1078
+ const retVal = (output || [])
1297
1079
  .filter((e) => e != null)
1298
1080
  .map((entry) => {
1299
1081
  if (entry === null) {
@@ -1301,6 +1083,7 @@ const deserializeAws_restJson1IntentList = (output, context) => {
1301
1083
  }
1302
1084
  return deserializeAws_restJson1PredictedIntent(entry, context);
1303
1085
  });
1086
+ return retVal;
1304
1087
  };
1305
1088
  const deserializeAws_restJson1IntentSummary = (output, context) => {
1306
1089
  return {
@@ -1316,7 +1099,7 @@ const deserializeAws_restJson1IntentSummary = (output, context) => {
1316
1099
  };
1317
1100
  };
1318
1101
  const deserializeAws_restJson1IntentSummaryList = (output, context) => {
1319
- return (output || [])
1102
+ const retVal = (output || [])
1320
1103
  .filter((e) => e != null)
1321
1104
  .map((entry) => {
1322
1105
  if (entry === null) {
@@ -1324,9 +1107,10 @@ const deserializeAws_restJson1IntentSummaryList = (output, context) => {
1324
1107
  }
1325
1108
  return deserializeAws_restJson1IntentSummary(entry, context);
1326
1109
  });
1110
+ return retVal;
1327
1111
  };
1328
1112
  const deserializeAws_restJson1listOfButtons = (output, context) => {
1329
- return (output || [])
1113
+ const retVal = (output || [])
1330
1114
  .filter((e) => e != null)
1331
1115
  .map((entry) => {
1332
1116
  if (entry === null) {
@@ -1334,6 +1118,7 @@ const deserializeAws_restJson1listOfButtons = (output, context) => {
1334
1118
  }
1335
1119
  return deserializeAws_restJson1Button(entry, context);
1336
1120
  });
1121
+ return retVal;
1337
1122
  };
1338
1123
  const deserializeAws_restJson1PredictedIntent = (output, context) => {
1339
1124
  return {