@aws-sdk/client-cloudsearch 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.
@@ -6,6 +6,8 @@ const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const entities_1 = require("entities");
8
8
  const fast_xml_parser_1 = require("fast-xml-parser");
9
+ const CloudSearchServiceException_1 = require("../models/CloudSearchServiceException");
10
+ const models_0_1 = require("../models/models_0");
9
11
  const serializeAws_queryBuildSuggestersCommand = async (input, context) => {
10
12
  const headers = {
11
13
  "content-type": "application/x-www-form-urlencoded",
@@ -367,51 +369,25 @@ const deserializeAws_queryBuildSuggestersCommandError = async (output, context)
367
369
  switch (errorCode) {
368
370
  case "BaseException":
369
371
  case "com.amazonaws.cloudsearch#BaseException":
370
- response = {
371
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
372
- name: errorCode,
373
- $metadata: deserializeMetadata(output),
374
- };
375
- break;
372
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
376
373
  case "InternalException":
377
374
  case "com.amazonaws.cloudsearch#InternalException":
378
- response = {
379
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
380
- name: errorCode,
381
- $metadata: deserializeMetadata(output),
382
- };
383
- break;
375
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
384
376
  case "ResourceNotFoundException":
385
377
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
386
- response = {
387
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
388
- name: errorCode,
389
- $metadata: deserializeMetadata(output),
390
- };
391
- break;
378
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
392
379
  case "ValidationException":
393
380
  case "com.amazonaws.cloudsearch#ValidationException":
394
- response = {
395
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
396
- name: errorCode,
397
- $metadata: deserializeMetadata(output),
398
- };
399
- break;
381
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
400
382
  default:
401
383
  const parsedBody = parsedOutput.body;
402
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
403
- response = {
404
- ...parsedBody.Error,
405
- name: `${errorCode}`,
406
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
384
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
385
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
407
386
  $fault: "client",
408
387
  $metadata: deserializeMetadata(output),
409
- };
388
+ });
389
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
410
390
  }
411
- const message = response.message || response.Message || errorCode;
412
- response.message = message;
413
- delete response.Message;
414
- return Promise.reject(Object.assign(new Error(message), response));
415
391
  };
416
392
  const deserializeAws_queryCreateDomainCommand = async (output, context) => {
417
393
  if (output.statusCode >= 300) {
@@ -438,59 +414,28 @@ const deserializeAws_queryCreateDomainCommandError = async (output, context) =>
438
414
  switch (errorCode) {
439
415
  case "BaseException":
440
416
  case "com.amazonaws.cloudsearch#BaseException":
441
- response = {
442
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
443
- name: errorCode,
444
- $metadata: deserializeMetadata(output),
445
- };
446
- break;
417
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
447
418
  case "InternalException":
448
419
  case "com.amazonaws.cloudsearch#InternalException":
449
- response = {
450
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
451
- name: errorCode,
452
- $metadata: deserializeMetadata(output),
453
- };
454
- break;
420
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
455
421
  case "LimitExceededException":
456
422
  case "com.amazonaws.cloudsearch#LimitExceededException":
457
- response = {
458
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
459
- name: errorCode,
460
- $metadata: deserializeMetadata(output),
461
- };
462
- break;
423
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
463
424
  case "ResourceAlreadyExistsException":
464
425
  case "com.amazonaws.cloudsearch#ResourceAlreadyExistsException":
465
- response = {
466
- ...(await deserializeAws_queryResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
467
- name: errorCode,
468
- $metadata: deserializeMetadata(output),
469
- };
470
- break;
426
+ throw await deserializeAws_queryResourceAlreadyExistsExceptionResponse(parsedOutput, context);
471
427
  case "ValidationException":
472
428
  case "com.amazonaws.cloudsearch#ValidationException":
473
- response = {
474
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
475
- name: errorCode,
476
- $metadata: deserializeMetadata(output),
477
- };
478
- break;
429
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
479
430
  default:
480
431
  const parsedBody = parsedOutput.body;
481
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
482
- response = {
483
- ...parsedBody.Error,
484
- name: `${errorCode}`,
485
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
432
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
433
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
486
434
  $fault: "client",
487
435
  $metadata: deserializeMetadata(output),
488
- };
436
+ });
437
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
489
438
  }
490
- const message = response.message || response.Message || errorCode;
491
- response.message = message;
492
- delete response.Message;
493
- return Promise.reject(Object.assign(new Error(message), response));
494
439
  };
495
440
  const deserializeAws_queryDefineAnalysisSchemeCommand = async (output, context) => {
496
441
  if (output.statusCode >= 300) {
@@ -517,67 +462,31 @@ const deserializeAws_queryDefineAnalysisSchemeCommandError = async (output, cont
517
462
  switch (errorCode) {
518
463
  case "BaseException":
519
464
  case "com.amazonaws.cloudsearch#BaseException":
520
- response = {
521
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
522
- name: errorCode,
523
- $metadata: deserializeMetadata(output),
524
- };
525
- break;
465
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
526
466
  case "InternalException":
527
467
  case "com.amazonaws.cloudsearch#InternalException":
528
- response = {
529
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
530
- name: errorCode,
531
- $metadata: deserializeMetadata(output),
532
- };
533
- break;
468
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
534
469
  case "InvalidTypeException":
535
470
  case "com.amazonaws.cloudsearch#InvalidTypeException":
536
- response = {
537
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
538
- name: errorCode,
539
- $metadata: deserializeMetadata(output),
540
- };
541
- break;
471
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
542
472
  case "LimitExceededException":
543
473
  case "com.amazonaws.cloudsearch#LimitExceededException":
544
- response = {
545
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
546
- name: errorCode,
547
- $metadata: deserializeMetadata(output),
548
- };
549
- break;
474
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
550
475
  case "ResourceNotFoundException":
551
476
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
552
- response = {
553
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
554
- name: errorCode,
555
- $metadata: deserializeMetadata(output),
556
- };
557
- break;
477
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
558
478
  case "ValidationException":
559
479
  case "com.amazonaws.cloudsearch#ValidationException":
560
- response = {
561
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
562
- name: errorCode,
563
- $metadata: deserializeMetadata(output),
564
- };
565
- break;
480
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
566
481
  default:
567
482
  const parsedBody = parsedOutput.body;
568
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
569
- response = {
570
- ...parsedBody.Error,
571
- name: `${errorCode}`,
572
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
483
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
484
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
573
485
  $fault: "client",
574
486
  $metadata: deserializeMetadata(output),
575
- };
487
+ });
488
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
576
489
  }
577
- const message = response.message || response.Message || errorCode;
578
- response.message = message;
579
- delete response.Message;
580
- return Promise.reject(Object.assign(new Error(message), response));
581
490
  };
582
491
  const deserializeAws_queryDefineExpressionCommand = async (output, context) => {
583
492
  if (output.statusCode >= 300) {
@@ -604,67 +513,31 @@ const deserializeAws_queryDefineExpressionCommandError = async (output, context)
604
513
  switch (errorCode) {
605
514
  case "BaseException":
606
515
  case "com.amazonaws.cloudsearch#BaseException":
607
- response = {
608
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
609
- name: errorCode,
610
- $metadata: deserializeMetadata(output),
611
- };
612
- break;
516
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
613
517
  case "InternalException":
614
518
  case "com.amazonaws.cloudsearch#InternalException":
615
- response = {
616
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
617
- name: errorCode,
618
- $metadata: deserializeMetadata(output),
619
- };
620
- break;
519
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
621
520
  case "InvalidTypeException":
622
521
  case "com.amazonaws.cloudsearch#InvalidTypeException":
623
- response = {
624
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
625
- name: errorCode,
626
- $metadata: deserializeMetadata(output),
627
- };
628
- break;
522
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
629
523
  case "LimitExceededException":
630
524
  case "com.amazonaws.cloudsearch#LimitExceededException":
631
- response = {
632
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
633
- name: errorCode,
634
- $metadata: deserializeMetadata(output),
635
- };
636
- break;
525
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
637
526
  case "ResourceNotFoundException":
638
527
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
639
- response = {
640
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
641
- name: errorCode,
642
- $metadata: deserializeMetadata(output),
643
- };
644
- break;
528
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
645
529
  case "ValidationException":
646
530
  case "com.amazonaws.cloudsearch#ValidationException":
647
- response = {
648
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
649
- name: errorCode,
650
- $metadata: deserializeMetadata(output),
651
- };
652
- break;
531
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
653
532
  default:
654
533
  const parsedBody = parsedOutput.body;
655
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
656
- response = {
657
- ...parsedBody.Error,
658
- name: `${errorCode}`,
659
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
534
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
535
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
660
536
  $fault: "client",
661
537
  $metadata: deserializeMetadata(output),
662
- };
538
+ });
539
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
663
540
  }
664
- const message = response.message || response.Message || errorCode;
665
- response.message = message;
666
- delete response.Message;
667
- return Promise.reject(Object.assign(new Error(message), response));
668
541
  };
669
542
  const deserializeAws_queryDefineIndexFieldCommand = async (output, context) => {
670
543
  if (output.statusCode >= 300) {
@@ -691,67 +564,31 @@ const deserializeAws_queryDefineIndexFieldCommandError = async (output, context)
691
564
  switch (errorCode) {
692
565
  case "BaseException":
693
566
  case "com.amazonaws.cloudsearch#BaseException":
694
- response = {
695
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
696
- name: errorCode,
697
- $metadata: deserializeMetadata(output),
698
- };
699
- break;
567
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
700
568
  case "InternalException":
701
569
  case "com.amazonaws.cloudsearch#InternalException":
702
- response = {
703
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
704
- name: errorCode,
705
- $metadata: deserializeMetadata(output),
706
- };
707
- break;
570
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
708
571
  case "InvalidTypeException":
709
572
  case "com.amazonaws.cloudsearch#InvalidTypeException":
710
- response = {
711
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
712
- name: errorCode,
713
- $metadata: deserializeMetadata(output),
714
- };
715
- break;
573
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
716
574
  case "LimitExceededException":
717
575
  case "com.amazonaws.cloudsearch#LimitExceededException":
718
- response = {
719
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
720
- name: errorCode,
721
- $metadata: deserializeMetadata(output),
722
- };
723
- break;
576
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
724
577
  case "ResourceNotFoundException":
725
578
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
726
- response = {
727
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
728
- name: errorCode,
729
- $metadata: deserializeMetadata(output),
730
- };
731
- break;
579
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
732
580
  case "ValidationException":
733
581
  case "com.amazonaws.cloudsearch#ValidationException":
734
- response = {
735
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
736
- name: errorCode,
737
- $metadata: deserializeMetadata(output),
738
- };
739
- break;
582
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
740
583
  default:
741
584
  const parsedBody = parsedOutput.body;
742
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
743
- response = {
744
- ...parsedBody.Error,
745
- name: `${errorCode}`,
746
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
585
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
586
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
747
587
  $fault: "client",
748
588
  $metadata: deserializeMetadata(output),
749
- };
589
+ });
590
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
750
591
  }
751
- const message = response.message || response.Message || errorCode;
752
- response.message = message;
753
- delete response.Message;
754
- return Promise.reject(Object.assign(new Error(message), response));
755
592
  };
756
593
  const deserializeAws_queryDefineSuggesterCommand = async (output, context) => {
757
594
  if (output.statusCode >= 300) {
@@ -778,67 +615,31 @@ const deserializeAws_queryDefineSuggesterCommandError = async (output, context)
778
615
  switch (errorCode) {
779
616
  case "BaseException":
780
617
  case "com.amazonaws.cloudsearch#BaseException":
781
- response = {
782
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
783
- name: errorCode,
784
- $metadata: deserializeMetadata(output),
785
- };
786
- break;
618
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
787
619
  case "InternalException":
788
620
  case "com.amazonaws.cloudsearch#InternalException":
789
- response = {
790
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
791
- name: errorCode,
792
- $metadata: deserializeMetadata(output),
793
- };
794
- break;
621
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
795
622
  case "InvalidTypeException":
796
623
  case "com.amazonaws.cloudsearch#InvalidTypeException":
797
- response = {
798
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
799
- name: errorCode,
800
- $metadata: deserializeMetadata(output),
801
- };
802
- break;
624
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
803
625
  case "LimitExceededException":
804
626
  case "com.amazonaws.cloudsearch#LimitExceededException":
805
- response = {
806
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
807
- name: errorCode,
808
- $metadata: deserializeMetadata(output),
809
- };
810
- break;
627
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
811
628
  case "ResourceNotFoundException":
812
629
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
813
- response = {
814
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
815
- name: errorCode,
816
- $metadata: deserializeMetadata(output),
817
- };
818
- break;
630
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
819
631
  case "ValidationException":
820
632
  case "com.amazonaws.cloudsearch#ValidationException":
821
- response = {
822
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
823
- name: errorCode,
824
- $metadata: deserializeMetadata(output),
825
- };
826
- break;
633
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
827
634
  default:
828
635
  const parsedBody = parsedOutput.body;
829
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
830
- response = {
831
- ...parsedBody.Error,
832
- name: `${errorCode}`,
833
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
636
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
637
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
834
638
  $fault: "client",
835
639
  $metadata: deserializeMetadata(output),
836
- };
640
+ });
641
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
837
642
  }
838
- const message = response.message || response.Message || errorCode;
839
- response.message = message;
840
- delete response.Message;
841
- return Promise.reject(Object.assign(new Error(message), response));
842
643
  };
843
644
  const deserializeAws_queryDeleteAnalysisSchemeCommand = async (output, context) => {
844
645
  if (output.statusCode >= 300) {
@@ -865,59 +666,28 @@ const deserializeAws_queryDeleteAnalysisSchemeCommandError = async (output, cont
865
666
  switch (errorCode) {
866
667
  case "BaseException":
867
668
  case "com.amazonaws.cloudsearch#BaseException":
868
- response = {
869
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
870
- name: errorCode,
871
- $metadata: deserializeMetadata(output),
872
- };
873
- break;
669
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
874
670
  case "InternalException":
875
671
  case "com.amazonaws.cloudsearch#InternalException":
876
- response = {
877
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
878
- name: errorCode,
879
- $metadata: deserializeMetadata(output),
880
- };
881
- break;
672
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
882
673
  case "InvalidTypeException":
883
674
  case "com.amazonaws.cloudsearch#InvalidTypeException":
884
- response = {
885
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
886
- name: errorCode,
887
- $metadata: deserializeMetadata(output),
888
- };
889
- break;
675
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
890
676
  case "ResourceNotFoundException":
891
677
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
892
- response = {
893
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
894
- name: errorCode,
895
- $metadata: deserializeMetadata(output),
896
- };
897
- break;
678
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
898
679
  case "ValidationException":
899
680
  case "com.amazonaws.cloudsearch#ValidationException":
900
- response = {
901
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
902
- name: errorCode,
903
- $metadata: deserializeMetadata(output),
904
- };
905
- break;
681
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
906
682
  default:
907
683
  const parsedBody = parsedOutput.body;
908
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
909
- response = {
910
- ...parsedBody.Error,
911
- name: `${errorCode}`,
912
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
684
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
685
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
913
686
  $fault: "client",
914
687
  $metadata: deserializeMetadata(output),
915
- };
688
+ });
689
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
916
690
  }
917
- const message = response.message || response.Message || errorCode;
918
- response.message = message;
919
- delete response.Message;
920
- return Promise.reject(Object.assign(new Error(message), response));
921
691
  };
922
692
  const deserializeAws_queryDeleteDomainCommand = async (output, context) => {
923
693
  if (output.statusCode >= 300) {
@@ -944,35 +714,19 @@ const deserializeAws_queryDeleteDomainCommandError = async (output, context) =>
944
714
  switch (errorCode) {
945
715
  case "BaseException":
946
716
  case "com.amazonaws.cloudsearch#BaseException":
947
- response = {
948
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
949
- name: errorCode,
950
- $metadata: deserializeMetadata(output),
951
- };
952
- break;
717
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
953
718
  case "InternalException":
954
719
  case "com.amazonaws.cloudsearch#InternalException":
955
- response = {
956
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
957
- name: errorCode,
958
- $metadata: deserializeMetadata(output),
959
- };
960
- break;
720
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
961
721
  default:
962
722
  const parsedBody = parsedOutput.body;
963
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
964
- response = {
965
- ...parsedBody.Error,
966
- name: `${errorCode}`,
967
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
723
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
724
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
968
725
  $fault: "client",
969
726
  $metadata: deserializeMetadata(output),
970
- };
727
+ });
728
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
971
729
  }
972
- const message = response.message || response.Message || errorCode;
973
- response.message = message;
974
- delete response.Message;
975
- return Promise.reject(Object.assign(new Error(message), response));
976
730
  };
977
731
  const deserializeAws_queryDeleteExpressionCommand = async (output, context) => {
978
732
  if (output.statusCode >= 300) {
@@ -999,59 +753,28 @@ const deserializeAws_queryDeleteExpressionCommandError = async (output, context)
999
753
  switch (errorCode) {
1000
754
  case "BaseException":
1001
755
  case "com.amazonaws.cloudsearch#BaseException":
1002
- response = {
1003
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1004
- name: errorCode,
1005
- $metadata: deserializeMetadata(output),
1006
- };
1007
- break;
756
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1008
757
  case "InternalException":
1009
758
  case "com.amazonaws.cloudsearch#InternalException":
1010
- response = {
1011
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1012
- name: errorCode,
1013
- $metadata: deserializeMetadata(output),
1014
- };
1015
- break;
759
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1016
760
  case "InvalidTypeException":
1017
761
  case "com.amazonaws.cloudsearch#InvalidTypeException":
1018
- response = {
1019
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
1020
- name: errorCode,
1021
- $metadata: deserializeMetadata(output),
1022
- };
1023
- break;
762
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
1024
763
  case "ResourceNotFoundException":
1025
764
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1026
- response = {
1027
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1028
- name: errorCode,
1029
- $metadata: deserializeMetadata(output),
1030
- };
1031
- break;
765
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1032
766
  case "ValidationException":
1033
767
  case "com.amazonaws.cloudsearch#ValidationException":
1034
- response = {
1035
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
1036
- name: errorCode,
1037
- $metadata: deserializeMetadata(output),
1038
- };
1039
- break;
768
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
1040
769
  default:
1041
770
  const parsedBody = parsedOutput.body;
1042
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1043
- response = {
1044
- ...parsedBody.Error,
1045
- name: `${errorCode}`,
1046
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
771
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
772
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1047
773
  $fault: "client",
1048
774
  $metadata: deserializeMetadata(output),
1049
- };
775
+ });
776
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1050
777
  }
1051
- const message = response.message || response.Message || errorCode;
1052
- response.message = message;
1053
- delete response.Message;
1054
- return Promise.reject(Object.assign(new Error(message), response));
1055
778
  };
1056
779
  const deserializeAws_queryDeleteIndexFieldCommand = async (output, context) => {
1057
780
  if (output.statusCode >= 300) {
@@ -1078,59 +801,28 @@ const deserializeAws_queryDeleteIndexFieldCommandError = async (output, context)
1078
801
  switch (errorCode) {
1079
802
  case "BaseException":
1080
803
  case "com.amazonaws.cloudsearch#BaseException":
1081
- response = {
1082
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1083
- name: errorCode,
1084
- $metadata: deserializeMetadata(output),
1085
- };
1086
- break;
804
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1087
805
  case "InternalException":
1088
806
  case "com.amazonaws.cloudsearch#InternalException":
1089
- response = {
1090
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1091
- name: errorCode,
1092
- $metadata: deserializeMetadata(output),
1093
- };
1094
- break;
807
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1095
808
  case "InvalidTypeException":
1096
809
  case "com.amazonaws.cloudsearch#InvalidTypeException":
1097
- response = {
1098
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
1099
- name: errorCode,
1100
- $metadata: deserializeMetadata(output),
1101
- };
1102
- break;
810
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
1103
811
  case "ResourceNotFoundException":
1104
812
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1105
- response = {
1106
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1107
- name: errorCode,
1108
- $metadata: deserializeMetadata(output),
1109
- };
1110
- break;
813
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1111
814
  case "ValidationException":
1112
815
  case "com.amazonaws.cloudsearch#ValidationException":
1113
- response = {
1114
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
1115
- name: errorCode,
1116
- $metadata: deserializeMetadata(output),
1117
- };
1118
- break;
816
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
1119
817
  default:
1120
818
  const parsedBody = parsedOutput.body;
1121
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1122
- response = {
1123
- ...parsedBody.Error,
1124
- name: `${errorCode}`,
1125
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
819
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
820
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1126
821
  $fault: "client",
1127
822
  $metadata: deserializeMetadata(output),
1128
- };
823
+ });
824
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1129
825
  }
1130
- const message = response.message || response.Message || errorCode;
1131
- response.message = message;
1132
- delete response.Message;
1133
- return Promise.reject(Object.assign(new Error(message), response));
1134
826
  };
1135
827
  const deserializeAws_queryDeleteSuggesterCommand = async (output, context) => {
1136
828
  if (output.statusCode >= 300) {
@@ -1157,59 +849,28 @@ const deserializeAws_queryDeleteSuggesterCommandError = async (output, context)
1157
849
  switch (errorCode) {
1158
850
  case "BaseException":
1159
851
  case "com.amazonaws.cloudsearch#BaseException":
1160
- response = {
1161
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1162
- name: errorCode,
1163
- $metadata: deserializeMetadata(output),
1164
- };
1165
- break;
852
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1166
853
  case "InternalException":
1167
854
  case "com.amazonaws.cloudsearch#InternalException":
1168
- response = {
1169
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1170
- name: errorCode,
1171
- $metadata: deserializeMetadata(output),
1172
- };
1173
- break;
855
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1174
856
  case "InvalidTypeException":
1175
857
  case "com.amazonaws.cloudsearch#InvalidTypeException":
1176
- response = {
1177
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
1178
- name: errorCode,
1179
- $metadata: deserializeMetadata(output),
1180
- };
1181
- break;
858
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
1182
859
  case "ResourceNotFoundException":
1183
860
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1184
- response = {
1185
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1186
- name: errorCode,
1187
- $metadata: deserializeMetadata(output),
1188
- };
1189
- break;
861
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1190
862
  case "ValidationException":
1191
863
  case "com.amazonaws.cloudsearch#ValidationException":
1192
- response = {
1193
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
1194
- name: errorCode,
1195
- $metadata: deserializeMetadata(output),
1196
- };
1197
- break;
864
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
1198
865
  default:
1199
866
  const parsedBody = parsedOutput.body;
1200
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1201
- response = {
1202
- ...parsedBody.Error,
1203
- name: `${errorCode}`,
1204
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
867
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
868
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1205
869
  $fault: "client",
1206
870
  $metadata: deserializeMetadata(output),
1207
- };
871
+ });
872
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1208
873
  }
1209
- const message = response.message || response.Message || errorCode;
1210
- response.message = message;
1211
- delete response.Message;
1212
- return Promise.reject(Object.assign(new Error(message), response));
1213
874
  };
1214
875
  const deserializeAws_queryDescribeAnalysisSchemesCommand = async (output, context) => {
1215
876
  if (output.statusCode >= 300) {
@@ -1236,43 +897,22 @@ const deserializeAws_queryDescribeAnalysisSchemesCommandError = async (output, c
1236
897
  switch (errorCode) {
1237
898
  case "BaseException":
1238
899
  case "com.amazonaws.cloudsearch#BaseException":
1239
- response = {
1240
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1241
- name: errorCode,
1242
- $metadata: deserializeMetadata(output),
1243
- };
1244
- break;
900
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1245
901
  case "InternalException":
1246
902
  case "com.amazonaws.cloudsearch#InternalException":
1247
- response = {
1248
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1249
- name: errorCode,
1250
- $metadata: deserializeMetadata(output),
1251
- };
1252
- break;
903
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1253
904
  case "ResourceNotFoundException":
1254
905
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1255
- response = {
1256
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1257
- name: errorCode,
1258
- $metadata: deserializeMetadata(output),
1259
- };
1260
- break;
906
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1261
907
  default:
1262
908
  const parsedBody = parsedOutput.body;
1263
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1264
- response = {
1265
- ...parsedBody.Error,
1266
- name: `${errorCode}`,
1267
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
909
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
910
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1268
911
  $fault: "client",
1269
912
  $metadata: deserializeMetadata(output),
1270
- };
913
+ });
914
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1271
915
  }
1272
- const message = response.message || response.Message || errorCode;
1273
- response.message = message;
1274
- delete response.Message;
1275
- return Promise.reject(Object.assign(new Error(message), response));
1276
916
  };
1277
917
  const deserializeAws_queryDescribeAvailabilityOptionsCommand = async (output, context) => {
1278
918
  if (output.statusCode >= 300) {
@@ -1299,67 +939,31 @@ const deserializeAws_queryDescribeAvailabilityOptionsCommandError = async (outpu
1299
939
  switch (errorCode) {
1300
940
  case "BaseException":
1301
941
  case "com.amazonaws.cloudsearch#BaseException":
1302
- response = {
1303
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1304
- name: errorCode,
1305
- $metadata: deserializeMetadata(output),
1306
- };
1307
- break;
942
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1308
943
  case "DisabledOperationException":
1309
944
  case "com.amazonaws.cloudsearch#DisabledOperationException":
1310
- response = {
1311
- ...(await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context)),
1312
- name: errorCode,
1313
- $metadata: deserializeMetadata(output),
1314
- };
1315
- break;
945
+ throw await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context);
1316
946
  case "InternalException":
1317
947
  case "com.amazonaws.cloudsearch#InternalException":
1318
- response = {
1319
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1320
- name: errorCode,
1321
- $metadata: deserializeMetadata(output),
1322
- };
1323
- break;
948
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1324
949
  case "InvalidTypeException":
1325
950
  case "com.amazonaws.cloudsearch#InvalidTypeException":
1326
- response = {
1327
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
1328
- name: errorCode,
1329
- $metadata: deserializeMetadata(output),
1330
- };
1331
- break;
951
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
1332
952
  case "LimitExceededException":
1333
953
  case "com.amazonaws.cloudsearch#LimitExceededException":
1334
- response = {
1335
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
1336
- name: errorCode,
1337
- $metadata: deserializeMetadata(output),
1338
- };
1339
- break;
954
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
1340
955
  case "ResourceNotFoundException":
1341
956
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1342
- response = {
1343
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1344
- name: errorCode,
1345
- $metadata: deserializeMetadata(output),
1346
- };
1347
- break;
957
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1348
958
  default:
1349
959
  const parsedBody = parsedOutput.body;
1350
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1351
- response = {
1352
- ...parsedBody.Error,
1353
- name: `${errorCode}`,
1354
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
960
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
961
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1355
962
  $fault: "client",
1356
963
  $metadata: deserializeMetadata(output),
1357
- };
964
+ });
965
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1358
966
  }
1359
- const message = response.message || response.Message || errorCode;
1360
- response.message = message;
1361
- delete response.Message;
1362
- return Promise.reject(Object.assign(new Error(message), response));
1363
967
  };
1364
968
  const deserializeAws_queryDescribeDomainEndpointOptionsCommand = async (output, context) => {
1365
969
  if (output.statusCode >= 300) {
@@ -1386,59 +990,28 @@ const deserializeAws_queryDescribeDomainEndpointOptionsCommandError = async (out
1386
990
  switch (errorCode) {
1387
991
  case "BaseException":
1388
992
  case "com.amazonaws.cloudsearch#BaseException":
1389
- response = {
1390
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1391
- name: errorCode,
1392
- $metadata: deserializeMetadata(output),
1393
- };
1394
- break;
993
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1395
994
  case "DisabledOperationException":
1396
995
  case "com.amazonaws.cloudsearch#DisabledOperationException":
1397
- response = {
1398
- ...(await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context)),
1399
- name: errorCode,
1400
- $metadata: deserializeMetadata(output),
1401
- };
1402
- break;
996
+ throw await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context);
1403
997
  case "InternalException":
1404
998
  case "com.amazonaws.cloudsearch#InternalException":
1405
- response = {
1406
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1407
- name: errorCode,
1408
- $metadata: deserializeMetadata(output),
1409
- };
1410
- break;
999
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1411
1000
  case "LimitExceededException":
1412
1001
  case "com.amazonaws.cloudsearch#LimitExceededException":
1413
- response = {
1414
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
1415
- name: errorCode,
1416
- $metadata: deserializeMetadata(output),
1417
- };
1418
- break;
1002
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
1419
1003
  case "ResourceNotFoundException":
1420
1004
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1421
- response = {
1422
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1423
- name: errorCode,
1424
- $metadata: deserializeMetadata(output),
1425
- };
1426
- break;
1005
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1427
1006
  default:
1428
1007
  const parsedBody = parsedOutput.body;
1429
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1430
- response = {
1431
- ...parsedBody.Error,
1432
- name: `${errorCode}`,
1433
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1008
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1009
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1434
1010
  $fault: "client",
1435
1011
  $metadata: deserializeMetadata(output),
1436
- };
1012
+ });
1013
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1437
1014
  }
1438
- const message = response.message || response.Message || errorCode;
1439
- response.message = message;
1440
- delete response.Message;
1441
- return Promise.reject(Object.assign(new Error(message), response));
1442
1015
  };
1443
1016
  const deserializeAws_queryDescribeDomainsCommand = async (output, context) => {
1444
1017
  if (output.statusCode >= 300) {
@@ -1465,35 +1038,19 @@ const deserializeAws_queryDescribeDomainsCommandError = async (output, context)
1465
1038
  switch (errorCode) {
1466
1039
  case "BaseException":
1467
1040
  case "com.amazonaws.cloudsearch#BaseException":
1468
- response = {
1469
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1470
- name: errorCode,
1471
- $metadata: deserializeMetadata(output),
1472
- };
1473
- break;
1041
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1474
1042
  case "InternalException":
1475
1043
  case "com.amazonaws.cloudsearch#InternalException":
1476
- response = {
1477
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1478
- name: errorCode,
1479
- $metadata: deserializeMetadata(output),
1480
- };
1481
- break;
1044
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1482
1045
  default:
1483
1046
  const parsedBody = parsedOutput.body;
1484
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1485
- response = {
1486
- ...parsedBody.Error,
1487
- name: `${errorCode}`,
1488
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1047
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1048
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1489
1049
  $fault: "client",
1490
1050
  $metadata: deserializeMetadata(output),
1491
- };
1051
+ });
1052
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1492
1053
  }
1493
- const message = response.message || response.Message || errorCode;
1494
- response.message = message;
1495
- delete response.Message;
1496
- return Promise.reject(Object.assign(new Error(message), response));
1497
1054
  };
1498
1055
  const deserializeAws_queryDescribeExpressionsCommand = async (output, context) => {
1499
1056
  if (output.statusCode >= 300) {
@@ -1520,43 +1077,22 @@ const deserializeAws_queryDescribeExpressionsCommandError = async (output, conte
1520
1077
  switch (errorCode) {
1521
1078
  case "BaseException":
1522
1079
  case "com.amazonaws.cloudsearch#BaseException":
1523
- response = {
1524
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1525
- name: errorCode,
1526
- $metadata: deserializeMetadata(output),
1527
- };
1528
- break;
1080
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1529
1081
  case "InternalException":
1530
1082
  case "com.amazonaws.cloudsearch#InternalException":
1531
- response = {
1532
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1533
- name: errorCode,
1534
- $metadata: deserializeMetadata(output),
1535
- };
1536
- break;
1083
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1537
1084
  case "ResourceNotFoundException":
1538
1085
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1539
- response = {
1540
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1541
- name: errorCode,
1542
- $metadata: deserializeMetadata(output),
1543
- };
1544
- break;
1086
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1545
1087
  default:
1546
1088
  const parsedBody = parsedOutput.body;
1547
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1548
- response = {
1549
- ...parsedBody.Error,
1550
- name: `${errorCode}`,
1551
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1089
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1090
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1552
1091
  $fault: "client",
1553
1092
  $metadata: deserializeMetadata(output),
1554
- };
1093
+ });
1094
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1555
1095
  }
1556
- const message = response.message || response.Message || errorCode;
1557
- response.message = message;
1558
- delete response.Message;
1559
- return Promise.reject(Object.assign(new Error(message), response));
1560
1096
  };
1561
1097
  const deserializeAws_queryDescribeIndexFieldsCommand = async (output, context) => {
1562
1098
  if (output.statusCode >= 300) {
@@ -1583,43 +1119,22 @@ const deserializeAws_queryDescribeIndexFieldsCommandError = async (output, conte
1583
1119
  switch (errorCode) {
1584
1120
  case "BaseException":
1585
1121
  case "com.amazonaws.cloudsearch#BaseException":
1586
- response = {
1587
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1588
- name: errorCode,
1589
- $metadata: deserializeMetadata(output),
1590
- };
1591
- break;
1122
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1592
1123
  case "InternalException":
1593
1124
  case "com.amazonaws.cloudsearch#InternalException":
1594
- response = {
1595
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1596
- name: errorCode,
1597
- $metadata: deserializeMetadata(output),
1598
- };
1599
- break;
1125
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1600
1126
  case "ResourceNotFoundException":
1601
1127
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1602
- response = {
1603
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1604
- name: errorCode,
1605
- $metadata: deserializeMetadata(output),
1606
- };
1607
- break;
1128
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1608
1129
  default:
1609
1130
  const parsedBody = parsedOutput.body;
1610
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1611
- response = {
1612
- ...parsedBody.Error,
1613
- name: `${errorCode}`,
1614
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1131
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1132
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1615
1133
  $fault: "client",
1616
1134
  $metadata: deserializeMetadata(output),
1617
- };
1135
+ });
1136
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1618
1137
  }
1619
- const message = response.message || response.Message || errorCode;
1620
- response.message = message;
1621
- delete response.Message;
1622
- return Promise.reject(Object.assign(new Error(message), response));
1623
1138
  };
1624
1139
  const deserializeAws_queryDescribeScalingParametersCommand = async (output, context) => {
1625
1140
  if (output.statusCode >= 300) {
@@ -1646,43 +1161,22 @@ const deserializeAws_queryDescribeScalingParametersCommandError = async (output,
1646
1161
  switch (errorCode) {
1647
1162
  case "BaseException":
1648
1163
  case "com.amazonaws.cloudsearch#BaseException":
1649
- response = {
1650
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1651
- name: errorCode,
1652
- $metadata: deserializeMetadata(output),
1653
- };
1654
- break;
1164
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1655
1165
  case "InternalException":
1656
1166
  case "com.amazonaws.cloudsearch#InternalException":
1657
- response = {
1658
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1659
- name: errorCode,
1660
- $metadata: deserializeMetadata(output),
1661
- };
1662
- break;
1167
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1663
1168
  case "ResourceNotFoundException":
1664
1169
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1665
- response = {
1666
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1667
- name: errorCode,
1668
- $metadata: deserializeMetadata(output),
1669
- };
1670
- break;
1170
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1671
1171
  default:
1672
1172
  const parsedBody = parsedOutput.body;
1673
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1674
- response = {
1675
- ...parsedBody.Error,
1676
- name: `${errorCode}`,
1677
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1173
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1174
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1678
1175
  $fault: "client",
1679
1176
  $metadata: deserializeMetadata(output),
1680
- };
1177
+ });
1178
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1681
1179
  }
1682
- const message = response.message || response.Message || errorCode;
1683
- response.message = message;
1684
- delete response.Message;
1685
- return Promise.reject(Object.assign(new Error(message), response));
1686
1180
  };
1687
1181
  const deserializeAws_queryDescribeServiceAccessPoliciesCommand = async (output, context) => {
1688
1182
  if (output.statusCode >= 300) {
@@ -1709,43 +1203,22 @@ const deserializeAws_queryDescribeServiceAccessPoliciesCommandError = async (out
1709
1203
  switch (errorCode) {
1710
1204
  case "BaseException":
1711
1205
  case "com.amazonaws.cloudsearch#BaseException":
1712
- response = {
1713
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1714
- name: errorCode,
1715
- $metadata: deserializeMetadata(output),
1716
- };
1717
- break;
1206
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1718
1207
  case "InternalException":
1719
1208
  case "com.amazonaws.cloudsearch#InternalException":
1720
- response = {
1721
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1722
- name: errorCode,
1723
- $metadata: deserializeMetadata(output),
1724
- };
1725
- break;
1209
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1726
1210
  case "ResourceNotFoundException":
1727
1211
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1728
- response = {
1729
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1730
- name: errorCode,
1731
- $metadata: deserializeMetadata(output),
1732
- };
1733
- break;
1212
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1734
1213
  default:
1735
1214
  const parsedBody = parsedOutput.body;
1736
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1737
- response = {
1738
- ...parsedBody.Error,
1739
- name: `${errorCode}`,
1740
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1215
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1216
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1741
1217
  $fault: "client",
1742
1218
  $metadata: deserializeMetadata(output),
1743
- };
1219
+ });
1220
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1744
1221
  }
1745
- const message = response.message || response.Message || errorCode;
1746
- response.message = message;
1747
- delete response.Message;
1748
- return Promise.reject(Object.assign(new Error(message), response));
1749
1222
  };
1750
1223
  const deserializeAws_queryDescribeSuggestersCommand = async (output, context) => {
1751
1224
  if (output.statusCode >= 300) {
@@ -1772,43 +1245,22 @@ const deserializeAws_queryDescribeSuggestersCommandError = async (output, contex
1772
1245
  switch (errorCode) {
1773
1246
  case "BaseException":
1774
1247
  case "com.amazonaws.cloudsearch#BaseException":
1775
- response = {
1776
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1777
- name: errorCode,
1778
- $metadata: deserializeMetadata(output),
1779
- };
1780
- break;
1248
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1781
1249
  case "InternalException":
1782
1250
  case "com.amazonaws.cloudsearch#InternalException":
1783
- response = {
1784
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1785
- name: errorCode,
1786
- $metadata: deserializeMetadata(output),
1787
- };
1788
- break;
1251
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1789
1252
  case "ResourceNotFoundException":
1790
1253
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1791
- response = {
1792
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1793
- name: errorCode,
1794
- $metadata: deserializeMetadata(output),
1795
- };
1796
- break;
1254
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1797
1255
  default:
1798
1256
  const parsedBody = parsedOutput.body;
1799
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1800
- response = {
1801
- ...parsedBody.Error,
1802
- name: `${errorCode}`,
1803
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1257
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1258
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1804
1259
  $fault: "client",
1805
1260
  $metadata: deserializeMetadata(output),
1806
- };
1261
+ });
1262
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1807
1263
  }
1808
- const message = response.message || response.Message || errorCode;
1809
- response.message = message;
1810
- delete response.Message;
1811
- return Promise.reject(Object.assign(new Error(message), response));
1812
1264
  };
1813
1265
  const deserializeAws_queryIndexDocumentsCommand = async (output, context) => {
1814
1266
  if (output.statusCode >= 300) {
@@ -1835,51 +1287,25 @@ const deserializeAws_queryIndexDocumentsCommandError = async (output, context) =
1835
1287
  switch (errorCode) {
1836
1288
  case "BaseException":
1837
1289
  case "com.amazonaws.cloudsearch#BaseException":
1838
- response = {
1839
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1840
- name: errorCode,
1841
- $metadata: deserializeMetadata(output),
1842
- };
1843
- break;
1290
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1844
1291
  case "InternalException":
1845
1292
  case "com.amazonaws.cloudsearch#InternalException":
1846
- response = {
1847
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1848
- name: errorCode,
1849
- $metadata: deserializeMetadata(output),
1850
- };
1851
- break;
1293
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1852
1294
  case "ResourceNotFoundException":
1853
1295
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1854
- response = {
1855
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1856
- name: errorCode,
1857
- $metadata: deserializeMetadata(output),
1858
- };
1859
- break;
1296
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
1860
1297
  case "ValidationException":
1861
1298
  case "com.amazonaws.cloudsearch#ValidationException":
1862
- response = {
1863
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
1864
- name: errorCode,
1865
- $metadata: deserializeMetadata(output),
1866
- };
1867
- break;
1299
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
1868
1300
  default:
1869
1301
  const parsedBody = parsedOutput.body;
1870
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1871
- response = {
1872
- ...parsedBody.Error,
1873
- name: `${errorCode}`,
1874
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1302
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1303
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1875
1304
  $fault: "client",
1876
1305
  $metadata: deserializeMetadata(output),
1877
- };
1306
+ });
1307
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1878
1308
  }
1879
- const message = response.message || response.Message || errorCode;
1880
- response.message = message;
1881
- delete response.Message;
1882
- return Promise.reject(Object.assign(new Error(message), response));
1883
1309
  };
1884
1310
  const deserializeAws_queryListDomainNamesCommand = async (output, context) => {
1885
1311
  if (output.statusCode >= 300) {
@@ -1906,27 +1332,16 @@ const deserializeAws_queryListDomainNamesCommandError = async (output, context)
1906
1332
  switch (errorCode) {
1907
1333
  case "BaseException":
1908
1334
  case "com.amazonaws.cloudsearch#BaseException":
1909
- response = {
1910
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1911
- name: errorCode,
1912
- $metadata: deserializeMetadata(output),
1913
- };
1914
- break;
1335
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1915
1336
  default:
1916
1337
  const parsedBody = parsedOutput.body;
1917
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
1918
- response = {
1919
- ...parsedBody.Error,
1920
- name: `${errorCode}`,
1921
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1338
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1339
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
1922
1340
  $fault: "client",
1923
1341
  $metadata: deserializeMetadata(output),
1924
- };
1342
+ });
1343
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
1925
1344
  }
1926
- const message = response.message || response.Message || errorCode;
1927
- response.message = message;
1928
- delete response.Message;
1929
- return Promise.reject(Object.assign(new Error(message), response));
1930
1345
  };
1931
1346
  const deserializeAws_queryUpdateAvailabilityOptionsCommand = async (output, context) => {
1932
1347
  if (output.statusCode >= 300) {
@@ -1953,75 +1368,34 @@ const deserializeAws_queryUpdateAvailabilityOptionsCommandError = async (output,
1953
1368
  switch (errorCode) {
1954
1369
  case "BaseException":
1955
1370
  case "com.amazonaws.cloudsearch#BaseException":
1956
- response = {
1957
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
1958
- name: errorCode,
1959
- $metadata: deserializeMetadata(output),
1960
- };
1961
- break;
1371
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
1962
1372
  case "DisabledOperationException":
1963
1373
  case "com.amazonaws.cloudsearch#DisabledOperationException":
1964
- response = {
1965
- ...(await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context)),
1966
- name: errorCode,
1967
- $metadata: deserializeMetadata(output),
1968
- };
1969
- break;
1374
+ throw await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context);
1970
1375
  case "InternalException":
1971
1376
  case "com.amazonaws.cloudsearch#InternalException":
1972
- response = {
1973
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
1974
- name: errorCode,
1975
- $metadata: deserializeMetadata(output),
1976
- };
1977
- break;
1377
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
1978
1378
  case "InvalidTypeException":
1979
1379
  case "com.amazonaws.cloudsearch#InvalidTypeException":
1980
- response = {
1981
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
1982
- name: errorCode,
1983
- $metadata: deserializeMetadata(output),
1984
- };
1985
- break;
1380
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
1986
1381
  case "LimitExceededException":
1987
1382
  case "com.amazonaws.cloudsearch#LimitExceededException":
1988
- response = {
1989
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
1990
- name: errorCode,
1991
- $metadata: deserializeMetadata(output),
1992
- };
1993
- break;
1383
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
1994
1384
  case "ResourceNotFoundException":
1995
1385
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
1996
- response = {
1997
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
1998
- name: errorCode,
1999
- $metadata: deserializeMetadata(output),
2000
- };
2001
- break;
1386
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2002
1387
  case "ValidationException":
2003
1388
  case "com.amazonaws.cloudsearch#ValidationException":
2004
- response = {
2005
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
2006
- name: errorCode,
2007
- $metadata: deserializeMetadata(output),
2008
- };
2009
- break;
1389
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
2010
1390
  default:
2011
1391
  const parsedBody = parsedOutput.body;
2012
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2013
- response = {
2014
- ...parsedBody.Error,
2015
- name: `${errorCode}`,
2016
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1392
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1393
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2017
1394
  $fault: "client",
2018
1395
  $metadata: deserializeMetadata(output),
2019
- };
1396
+ });
1397
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2020
1398
  }
2021
- const message = response.message || response.Message || errorCode;
2022
- response.message = message;
2023
- delete response.Message;
2024
- return Promise.reject(Object.assign(new Error(message), response));
2025
1399
  };
2026
1400
  const deserializeAws_queryUpdateDomainEndpointOptionsCommand = async (output, context) => {
2027
1401
  if (output.statusCode >= 300) {
@@ -2048,75 +1422,34 @@ const deserializeAws_queryUpdateDomainEndpointOptionsCommandError = async (outpu
2048
1422
  switch (errorCode) {
2049
1423
  case "BaseException":
2050
1424
  case "com.amazonaws.cloudsearch#BaseException":
2051
- response = {
2052
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
2053
- name: errorCode,
2054
- $metadata: deserializeMetadata(output),
2055
- };
2056
- break;
1425
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
2057
1426
  case "DisabledOperationException":
2058
1427
  case "com.amazonaws.cloudsearch#DisabledOperationException":
2059
- response = {
2060
- ...(await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context)),
2061
- name: errorCode,
2062
- $metadata: deserializeMetadata(output),
2063
- };
2064
- break;
1428
+ throw await deserializeAws_queryDisabledOperationExceptionResponse(parsedOutput, context);
2065
1429
  case "InternalException":
2066
1430
  case "com.amazonaws.cloudsearch#InternalException":
2067
- response = {
2068
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
2069
- name: errorCode,
2070
- $metadata: deserializeMetadata(output),
2071
- };
2072
- break;
1431
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
2073
1432
  case "InvalidTypeException":
2074
1433
  case "com.amazonaws.cloudsearch#InvalidTypeException":
2075
- response = {
2076
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
2077
- name: errorCode,
2078
- $metadata: deserializeMetadata(output),
2079
- };
2080
- break;
1434
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
2081
1435
  case "LimitExceededException":
2082
1436
  case "com.amazonaws.cloudsearch#LimitExceededException":
2083
- response = {
2084
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
2085
- name: errorCode,
2086
- $metadata: deserializeMetadata(output),
2087
- };
2088
- break;
1437
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
2089
1438
  case "ResourceNotFoundException":
2090
1439
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
2091
- response = {
2092
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
2093
- name: errorCode,
2094
- $metadata: deserializeMetadata(output),
2095
- };
2096
- break;
1440
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2097
1441
  case "ValidationException":
2098
1442
  case "com.amazonaws.cloudsearch#ValidationException":
2099
- response = {
2100
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
2101
- name: errorCode,
2102
- $metadata: deserializeMetadata(output),
2103
- };
2104
- break;
1443
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
2105
1444
  default:
2106
1445
  const parsedBody = parsedOutput.body;
2107
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2108
- response = {
2109
- ...parsedBody.Error,
2110
- name: `${errorCode}`,
2111
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1446
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1447
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2112
1448
  $fault: "client",
2113
1449
  $metadata: deserializeMetadata(output),
2114
- };
1450
+ });
1451
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2115
1452
  }
2116
- const message = response.message || response.Message || errorCode;
2117
- response.message = message;
2118
- delete response.Message;
2119
- return Promise.reject(Object.assign(new Error(message), response));
2120
1453
  };
2121
1454
  const deserializeAws_queryUpdateScalingParametersCommand = async (output, context) => {
2122
1455
  if (output.statusCode >= 300) {
@@ -2143,67 +1476,31 @@ const deserializeAws_queryUpdateScalingParametersCommandError = async (output, c
2143
1476
  switch (errorCode) {
2144
1477
  case "BaseException":
2145
1478
  case "com.amazonaws.cloudsearch#BaseException":
2146
- response = {
2147
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
2148
- name: errorCode,
2149
- $metadata: deserializeMetadata(output),
2150
- };
2151
- break;
1479
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
2152
1480
  case "InternalException":
2153
1481
  case "com.amazonaws.cloudsearch#InternalException":
2154
- response = {
2155
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
2156
- name: errorCode,
2157
- $metadata: deserializeMetadata(output),
2158
- };
2159
- break;
1482
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
2160
1483
  case "InvalidTypeException":
2161
1484
  case "com.amazonaws.cloudsearch#InvalidTypeException":
2162
- response = {
2163
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
2164
- name: errorCode,
2165
- $metadata: deserializeMetadata(output),
2166
- };
2167
- break;
1485
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
2168
1486
  case "LimitExceededException":
2169
1487
  case "com.amazonaws.cloudsearch#LimitExceededException":
2170
- response = {
2171
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
2172
- name: errorCode,
2173
- $metadata: deserializeMetadata(output),
2174
- };
2175
- break;
1488
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
2176
1489
  case "ResourceNotFoundException":
2177
1490
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
2178
- response = {
2179
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
2180
- name: errorCode,
2181
- $metadata: deserializeMetadata(output),
2182
- };
2183
- break;
1491
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2184
1492
  case "ValidationException":
2185
1493
  case "com.amazonaws.cloudsearch#ValidationException":
2186
- response = {
2187
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
2188
- name: errorCode,
2189
- $metadata: deserializeMetadata(output),
2190
- };
2191
- break;
1494
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
2192
1495
  default:
2193
1496
  const parsedBody = parsedOutput.body;
2194
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2195
- response = {
2196
- ...parsedBody.Error,
2197
- name: `${errorCode}`,
2198
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1497
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1498
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2199
1499
  $fault: "client",
2200
1500
  $metadata: deserializeMetadata(output),
2201
- };
1501
+ });
1502
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2202
1503
  }
2203
- const message = response.message || response.Message || errorCode;
2204
- response.message = message;
2205
- delete response.Message;
2206
- return Promise.reject(Object.assign(new Error(message), response));
2207
1504
  };
2208
1505
  const deserializeAws_queryUpdateServiceAccessPoliciesCommand = async (output, context) => {
2209
1506
  if (output.statusCode >= 300) {
@@ -2230,155 +1527,103 @@ const deserializeAws_queryUpdateServiceAccessPoliciesCommandError = async (outpu
2230
1527
  switch (errorCode) {
2231
1528
  case "BaseException":
2232
1529
  case "com.amazonaws.cloudsearch#BaseException":
2233
- response = {
2234
- ...(await deserializeAws_queryBaseExceptionResponse(parsedOutput, context)),
2235
- name: errorCode,
2236
- $metadata: deserializeMetadata(output),
2237
- };
2238
- break;
1530
+ throw await deserializeAws_queryBaseExceptionResponse(parsedOutput, context);
2239
1531
  case "InternalException":
2240
1532
  case "com.amazonaws.cloudsearch#InternalException":
2241
- response = {
2242
- ...(await deserializeAws_queryInternalExceptionResponse(parsedOutput, context)),
2243
- name: errorCode,
2244
- $metadata: deserializeMetadata(output),
2245
- };
2246
- break;
1533
+ throw await deserializeAws_queryInternalExceptionResponse(parsedOutput, context);
2247
1534
  case "InvalidTypeException":
2248
1535
  case "com.amazonaws.cloudsearch#InvalidTypeException":
2249
- response = {
2250
- ...(await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context)),
2251
- name: errorCode,
2252
- $metadata: deserializeMetadata(output),
2253
- };
2254
- break;
1536
+ throw await deserializeAws_queryInvalidTypeExceptionResponse(parsedOutput, context);
2255
1537
  case "LimitExceededException":
2256
1538
  case "com.amazonaws.cloudsearch#LimitExceededException":
2257
- response = {
2258
- ...(await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context)),
2259
- name: errorCode,
2260
- $metadata: deserializeMetadata(output),
2261
- };
2262
- break;
1539
+ throw await deserializeAws_queryLimitExceededExceptionResponse(parsedOutput, context);
2263
1540
  case "ResourceNotFoundException":
2264
1541
  case "com.amazonaws.cloudsearch#ResourceNotFoundException":
2265
- response = {
2266
- ...(await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context)),
2267
- name: errorCode,
2268
- $metadata: deserializeMetadata(output),
2269
- };
2270
- break;
1542
+ throw await deserializeAws_queryResourceNotFoundExceptionResponse(parsedOutput, context);
2271
1543
  case "ValidationException":
2272
1544
  case "com.amazonaws.cloudsearch#ValidationException":
2273
- response = {
2274
- ...(await deserializeAws_queryValidationExceptionResponse(parsedOutput, context)),
2275
- name: errorCode,
2276
- $metadata: deserializeMetadata(output),
2277
- };
2278
- break;
1545
+ throw await deserializeAws_queryValidationExceptionResponse(parsedOutput, context);
2279
1546
  default:
2280
1547
  const parsedBody = parsedOutput.body;
2281
- errorCode = parsedBody.Error.code || parsedBody.Error.Code || errorCode;
2282
- response = {
2283
- ...parsedBody.Error,
2284
- name: `${errorCode}`,
2285
- message: parsedBody.Error.message || parsedBody.Error.Message || errorCode,
1548
+ response = new CloudSearchServiceException_1.CloudSearchServiceException({
1549
+ name: parsedBody.Error.code || parsedBody.Error.Code || errorCode,
2286
1550
  $fault: "client",
2287
1551
  $metadata: deserializeMetadata(output),
2288
- };
1552
+ });
1553
+ throw smithy_client_1.decorateServiceException(response, parsedBody.Error);
2289
1554
  }
2290
- const message = response.message || response.Message || errorCode;
2291
- response.message = message;
2292
- delete response.Message;
2293
- return Promise.reject(Object.assign(new Error(message), response));
2294
1555
  };
2295
1556
  const deserializeAws_queryBaseExceptionResponse = async (parsedOutput, context) => {
2296
1557
  const body = parsedOutput.body;
2297
1558
  const deserialized = deserializeAws_queryBaseException(body.Error, context);
2298
- const contents = {
2299
- name: "BaseException",
2300
- $fault: "client",
1559
+ const exception = new models_0_1.BaseException({
2301
1560
  $metadata: deserializeMetadata(parsedOutput),
2302
1561
  ...deserialized,
2303
- };
2304
- return contents;
1562
+ });
1563
+ return smithy_client_1.decorateServiceException(exception, body);
2305
1564
  };
2306
1565
  const deserializeAws_queryDisabledOperationExceptionResponse = async (parsedOutput, context) => {
2307
1566
  const body = parsedOutput.body;
2308
1567
  const deserialized = deserializeAws_queryDisabledOperationException(body.Error, context);
2309
- const contents = {
2310
- name: "DisabledOperationException",
2311
- $fault: "client",
1568
+ const exception = new models_0_1.DisabledOperationException({
2312
1569
  $metadata: deserializeMetadata(parsedOutput),
2313
1570
  ...deserialized,
2314
- };
2315
- return contents;
1571
+ });
1572
+ return smithy_client_1.decorateServiceException(exception, body);
2316
1573
  };
2317
1574
  const deserializeAws_queryInternalExceptionResponse = async (parsedOutput, context) => {
2318
1575
  const body = parsedOutput.body;
2319
1576
  const deserialized = deserializeAws_queryInternalException(body.Error, context);
2320
- const contents = {
2321
- name: "InternalException",
2322
- $fault: "server",
1577
+ const exception = new models_0_1.InternalException({
2323
1578
  $metadata: deserializeMetadata(parsedOutput),
2324
1579
  ...deserialized,
2325
- };
2326
- return contents;
1580
+ });
1581
+ return smithy_client_1.decorateServiceException(exception, body);
2327
1582
  };
2328
1583
  const deserializeAws_queryInvalidTypeExceptionResponse = async (parsedOutput, context) => {
2329
1584
  const body = parsedOutput.body;
2330
1585
  const deserialized = deserializeAws_queryInvalidTypeException(body.Error, context);
2331
- const contents = {
2332
- name: "InvalidTypeException",
2333
- $fault: "client",
1586
+ const exception = new models_0_1.InvalidTypeException({
2334
1587
  $metadata: deserializeMetadata(parsedOutput),
2335
1588
  ...deserialized,
2336
- };
2337
- return contents;
1589
+ });
1590
+ return smithy_client_1.decorateServiceException(exception, body);
2338
1591
  };
2339
1592
  const deserializeAws_queryLimitExceededExceptionResponse = async (parsedOutput, context) => {
2340
1593
  const body = parsedOutput.body;
2341
1594
  const deserialized = deserializeAws_queryLimitExceededException(body.Error, context);
2342
- const contents = {
2343
- name: "LimitExceededException",
2344
- $fault: "client",
1595
+ const exception = new models_0_1.LimitExceededException({
2345
1596
  $metadata: deserializeMetadata(parsedOutput),
2346
1597
  ...deserialized,
2347
- };
2348
- return contents;
1598
+ });
1599
+ return smithy_client_1.decorateServiceException(exception, body);
2349
1600
  };
2350
1601
  const deserializeAws_queryResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
2351
1602
  const body = parsedOutput.body;
2352
1603
  const deserialized = deserializeAws_queryResourceAlreadyExistsException(body.Error, context);
2353
- const contents = {
2354
- name: "ResourceAlreadyExistsException",
2355
- $fault: "client",
1604
+ const exception = new models_0_1.ResourceAlreadyExistsException({
2356
1605
  $metadata: deserializeMetadata(parsedOutput),
2357
1606
  ...deserialized,
2358
- };
2359
- return contents;
1607
+ });
1608
+ return smithy_client_1.decorateServiceException(exception, body);
2360
1609
  };
2361
1610
  const deserializeAws_queryResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2362
1611
  const body = parsedOutput.body;
2363
1612
  const deserialized = deserializeAws_queryResourceNotFoundException(body.Error, context);
2364
- const contents = {
2365
- name: "ResourceNotFoundException",
2366
- $fault: "client",
1613
+ const exception = new models_0_1.ResourceNotFoundException({
2367
1614
  $metadata: deserializeMetadata(parsedOutput),
2368
1615
  ...deserialized,
2369
- };
2370
- return contents;
1616
+ });
1617
+ return smithy_client_1.decorateServiceException(exception, body);
2371
1618
  };
2372
1619
  const deserializeAws_queryValidationExceptionResponse = async (parsedOutput, context) => {
2373
1620
  const body = parsedOutput.body;
2374
1621
  const deserialized = deserializeAws_queryValidationException(body.Error, context);
2375
- const contents = {
2376
- name: "ValidationException",
2377
- $fault: "client",
1622
+ const exception = new models_0_1.ValidationException({
2378
1623
  $metadata: deserializeMetadata(parsedOutput),
2379
1624
  ...deserialized,
2380
- };
2381
- return contents;
1625
+ });
1626
+ return smithy_client_1.decorateServiceException(exception, body);
2382
1627
  };
2383
1628
  const serializeAws_queryAnalysisOptions = (input, context) => {
2384
1629
  const entries = {};