@aws-sdk/client-ssm-contacts 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.
@@ -5,6 +5,8 @@ exports.deserializeAws_json1_1UpdateContactChannelCommand = exports.deserializeA
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const uuid_1 = require("uuid");
8
+ const models_0_1 = require("../models/models_0");
9
+ const SSMContactsServiceException_1 = require("../models/SSMContactsServiceException");
8
10
  const serializeAws_json1_1AcceptPageCommand = async (input, context) => {
9
11
  const headers = {
10
12
  "content-type": "application/x-amz-json-1.1",
@@ -300,59 +302,28 @@ const deserializeAws_json1_1AcceptPageCommandError = async (output, context) =>
300
302
  switch (errorCode) {
301
303
  case "AccessDeniedException":
302
304
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
303
- response = {
304
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
305
- name: errorCode,
306
- $metadata: deserializeMetadata(output),
307
- };
308
- break;
305
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
309
306
  case "InternalServerException":
310
307
  case "com.amazonaws.ssmcontacts#InternalServerException":
311
- response = {
312
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
313
- name: errorCode,
314
- $metadata: deserializeMetadata(output),
315
- };
316
- break;
308
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
317
309
  case "ResourceNotFoundException":
318
310
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
319
- response = {
320
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
321
- name: errorCode,
322
- $metadata: deserializeMetadata(output),
323
- };
324
- break;
311
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
325
312
  case "ThrottlingException":
326
313
  case "com.amazonaws.ssmcontacts#ThrottlingException":
327
- response = {
328
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
329
- name: errorCode,
330
- $metadata: deserializeMetadata(output),
331
- };
332
- break;
314
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
333
315
  case "ValidationException":
334
316
  case "com.amazonaws.ssmcontacts#ValidationException":
335
- response = {
336
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
337
- name: errorCode,
338
- $metadata: deserializeMetadata(output),
339
- };
340
- break;
317
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
341
318
  default:
342
319
  const parsedBody = parsedOutput.body;
343
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
344
- response = {
345
- ...parsedBody,
346
- name: `${errorCode}`,
347
- message: parsedBody.message || parsedBody.Message || errorCode,
320
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
321
+ name: parsedBody.code || parsedBody.Code || errorCode,
348
322
  $fault: "client",
349
323
  $metadata: deserializeMetadata(output),
350
- };
324
+ });
325
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
351
326
  }
352
- const message = response.message || response.Message || errorCode;
353
- response.message = message;
354
- delete response.Message;
355
- return Promise.reject(Object.assign(new Error(message), response));
356
327
  };
357
328
  const deserializeAws_json1_1ActivateContactChannelCommand = async (output, context) => {
358
329
  if (output.statusCode >= 300) {
@@ -379,59 +350,28 @@ const deserializeAws_json1_1ActivateContactChannelCommandError = async (output,
379
350
  switch (errorCode) {
380
351
  case "AccessDeniedException":
381
352
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
382
- response = {
383
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
384
- name: errorCode,
385
- $metadata: deserializeMetadata(output),
386
- };
387
- break;
353
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
388
354
  case "InternalServerException":
389
355
  case "com.amazonaws.ssmcontacts#InternalServerException":
390
- response = {
391
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
392
- name: errorCode,
393
- $metadata: deserializeMetadata(output),
394
- };
395
- break;
356
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
396
357
  case "ResourceNotFoundException":
397
358
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
398
- response = {
399
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
400
- name: errorCode,
401
- $metadata: deserializeMetadata(output),
402
- };
403
- break;
359
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
404
360
  case "ThrottlingException":
405
361
  case "com.amazonaws.ssmcontacts#ThrottlingException":
406
- response = {
407
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
408
- name: errorCode,
409
- $metadata: deserializeMetadata(output),
410
- };
411
- break;
362
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
412
363
  case "ValidationException":
413
364
  case "com.amazonaws.ssmcontacts#ValidationException":
414
- response = {
415
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
416
- name: errorCode,
417
- $metadata: deserializeMetadata(output),
418
- };
419
- break;
365
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
420
366
  default:
421
367
  const parsedBody = parsedOutput.body;
422
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
423
- response = {
424
- ...parsedBody,
425
- name: `${errorCode}`,
426
- message: parsedBody.message || parsedBody.Message || errorCode,
368
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
369
+ name: parsedBody.code || parsedBody.Code || errorCode,
427
370
  $fault: "client",
428
371
  $metadata: deserializeMetadata(output),
429
- };
372
+ });
373
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
430
374
  }
431
- const message = response.message || response.Message || errorCode;
432
- response.message = message;
433
- delete response.Message;
434
- return Promise.reject(Object.assign(new Error(message), response));
435
375
  };
436
376
  const deserializeAws_json1_1CreateContactCommand = async (output, context) => {
437
377
  if (output.statusCode >= 300) {
@@ -458,75 +398,34 @@ const deserializeAws_json1_1CreateContactCommandError = async (output, context)
458
398
  switch (errorCode) {
459
399
  case "AccessDeniedException":
460
400
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
461
- response = {
462
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
463
- name: errorCode,
464
- $metadata: deserializeMetadata(output),
465
- };
466
- break;
401
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
467
402
  case "ConflictException":
468
403
  case "com.amazonaws.ssmcontacts#ConflictException":
469
- response = {
470
- ...(await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context)),
471
- name: errorCode,
472
- $metadata: deserializeMetadata(output),
473
- };
474
- break;
404
+ throw await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context);
475
405
  case "DataEncryptionException":
476
406
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
477
- response = {
478
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
479
- name: errorCode,
480
- $metadata: deserializeMetadata(output),
481
- };
482
- break;
407
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
483
408
  case "InternalServerException":
484
409
  case "com.amazonaws.ssmcontacts#InternalServerException":
485
- response = {
486
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
487
- name: errorCode,
488
- $metadata: deserializeMetadata(output),
489
- };
490
- break;
410
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
491
411
  case "ServiceQuotaExceededException":
492
412
  case "com.amazonaws.ssmcontacts#ServiceQuotaExceededException":
493
- response = {
494
- ...(await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
495
- name: errorCode,
496
- $metadata: deserializeMetadata(output),
497
- };
498
- break;
413
+ throw await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
499
414
  case "ThrottlingException":
500
415
  case "com.amazonaws.ssmcontacts#ThrottlingException":
501
- response = {
502
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
503
- name: errorCode,
504
- $metadata: deserializeMetadata(output),
505
- };
506
- break;
416
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
507
417
  case "ValidationException":
508
418
  case "com.amazonaws.ssmcontacts#ValidationException":
509
- response = {
510
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
511
- name: errorCode,
512
- $metadata: deserializeMetadata(output),
513
- };
514
- break;
419
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
515
420
  default:
516
421
  const parsedBody = parsedOutput.body;
517
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
518
- response = {
519
- ...parsedBody,
520
- name: `${errorCode}`,
521
- message: parsedBody.message || parsedBody.Message || errorCode,
422
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
423
+ name: parsedBody.code || parsedBody.Code || errorCode,
522
424
  $fault: "client",
523
425
  $metadata: deserializeMetadata(output),
524
- };
426
+ });
427
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
525
428
  }
526
- const message = response.message || response.Message || errorCode;
527
- response.message = message;
528
- delete response.Message;
529
- return Promise.reject(Object.assign(new Error(message), response));
530
429
  };
531
430
  const deserializeAws_json1_1CreateContactChannelCommand = async (output, context) => {
532
431
  if (output.statusCode >= 300) {
@@ -553,67 +452,31 @@ const deserializeAws_json1_1CreateContactChannelCommandError = async (output, co
553
452
  switch (errorCode) {
554
453
  case "AccessDeniedException":
555
454
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
556
- response = {
557
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
558
- name: errorCode,
559
- $metadata: deserializeMetadata(output),
560
- };
561
- break;
455
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
562
456
  case "ConflictException":
563
457
  case "com.amazonaws.ssmcontacts#ConflictException":
564
- response = {
565
- ...(await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context)),
566
- name: errorCode,
567
- $metadata: deserializeMetadata(output),
568
- };
569
- break;
458
+ throw await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context);
570
459
  case "DataEncryptionException":
571
460
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
572
- response = {
573
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
574
- name: errorCode,
575
- $metadata: deserializeMetadata(output),
576
- };
577
- break;
461
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
578
462
  case "InternalServerException":
579
463
  case "com.amazonaws.ssmcontacts#InternalServerException":
580
- response = {
581
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
582
- name: errorCode,
583
- $metadata: deserializeMetadata(output),
584
- };
585
- break;
464
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
586
465
  case "ThrottlingException":
587
466
  case "com.amazonaws.ssmcontacts#ThrottlingException":
588
- response = {
589
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
590
- name: errorCode,
591
- $metadata: deserializeMetadata(output),
592
- };
593
- break;
467
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
594
468
  case "ValidationException":
595
469
  case "com.amazonaws.ssmcontacts#ValidationException":
596
- response = {
597
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
598
- name: errorCode,
599
- $metadata: deserializeMetadata(output),
600
- };
601
- break;
470
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
602
471
  default:
603
472
  const parsedBody = parsedOutput.body;
604
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
605
- response = {
606
- ...parsedBody,
607
- name: `${errorCode}`,
608
- message: parsedBody.message || parsedBody.Message || errorCode,
473
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
474
+ name: parsedBody.code || parsedBody.Code || errorCode,
609
475
  $fault: "client",
610
476
  $metadata: deserializeMetadata(output),
611
- };
477
+ });
478
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
612
479
  }
613
- const message = response.message || response.Message || errorCode;
614
- response.message = message;
615
- delete response.Message;
616
- return Promise.reject(Object.assign(new Error(message), response));
617
480
  };
618
481
  const deserializeAws_json1_1DeactivateContactChannelCommand = async (output, context) => {
619
482
  if (output.statusCode >= 300) {
@@ -640,59 +503,28 @@ const deserializeAws_json1_1DeactivateContactChannelCommandError = async (output
640
503
  switch (errorCode) {
641
504
  case "AccessDeniedException":
642
505
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
643
- response = {
644
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
645
- name: errorCode,
646
- $metadata: deserializeMetadata(output),
647
- };
648
- break;
506
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
649
507
  case "InternalServerException":
650
508
  case "com.amazonaws.ssmcontacts#InternalServerException":
651
- response = {
652
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
653
- name: errorCode,
654
- $metadata: deserializeMetadata(output),
655
- };
656
- break;
509
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
657
510
  case "ResourceNotFoundException":
658
511
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
659
- response = {
660
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
661
- name: errorCode,
662
- $metadata: deserializeMetadata(output),
663
- };
664
- break;
512
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
665
513
  case "ThrottlingException":
666
514
  case "com.amazonaws.ssmcontacts#ThrottlingException":
667
- response = {
668
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
669
- name: errorCode,
670
- $metadata: deserializeMetadata(output),
671
- };
672
- break;
515
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
673
516
  case "ValidationException":
674
517
  case "com.amazonaws.ssmcontacts#ValidationException":
675
- response = {
676
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
677
- name: errorCode,
678
- $metadata: deserializeMetadata(output),
679
- };
680
- break;
518
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
681
519
  default:
682
520
  const parsedBody = parsedOutput.body;
683
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
684
- response = {
685
- ...parsedBody,
686
- name: `${errorCode}`,
687
- message: parsedBody.message || parsedBody.Message || errorCode,
521
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
522
+ name: parsedBody.code || parsedBody.Code || errorCode,
688
523
  $fault: "client",
689
524
  $metadata: deserializeMetadata(output),
690
- };
525
+ });
526
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
691
527
  }
692
- const message = response.message || response.Message || errorCode;
693
- response.message = message;
694
- delete response.Message;
695
- return Promise.reject(Object.assign(new Error(message), response));
696
528
  };
697
529
  const deserializeAws_json1_1DeleteContactCommand = async (output, context) => {
698
530
  if (output.statusCode >= 300) {
@@ -719,59 +551,28 @@ const deserializeAws_json1_1DeleteContactCommandError = async (output, context)
719
551
  switch (errorCode) {
720
552
  case "AccessDeniedException":
721
553
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
722
- response = {
723
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
724
- name: errorCode,
725
- $metadata: deserializeMetadata(output),
726
- };
727
- break;
554
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
728
555
  case "InternalServerException":
729
556
  case "com.amazonaws.ssmcontacts#InternalServerException":
730
- response = {
731
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
732
- name: errorCode,
733
- $metadata: deserializeMetadata(output),
734
- };
735
- break;
557
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
736
558
  case "ResourceNotFoundException":
737
559
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
738
- response = {
739
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
740
- name: errorCode,
741
- $metadata: deserializeMetadata(output),
742
- };
743
- break;
560
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
744
561
  case "ThrottlingException":
745
562
  case "com.amazonaws.ssmcontacts#ThrottlingException":
746
- response = {
747
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
748
- name: errorCode,
749
- $metadata: deserializeMetadata(output),
750
- };
751
- break;
563
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
752
564
  case "ValidationException":
753
565
  case "com.amazonaws.ssmcontacts#ValidationException":
754
- response = {
755
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
756
- name: errorCode,
757
- $metadata: deserializeMetadata(output),
758
- };
759
- break;
566
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
760
567
  default:
761
568
  const parsedBody = parsedOutput.body;
762
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
763
- response = {
764
- ...parsedBody,
765
- name: `${errorCode}`,
766
- message: parsedBody.message || parsedBody.Message || errorCode,
569
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
570
+ name: parsedBody.code || parsedBody.Code || errorCode,
767
571
  $fault: "client",
768
572
  $metadata: deserializeMetadata(output),
769
- };
573
+ });
574
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
770
575
  }
771
- const message = response.message || response.Message || errorCode;
772
- response.message = message;
773
- delete response.Message;
774
- return Promise.reject(Object.assign(new Error(message), response));
775
576
  };
776
577
  const deserializeAws_json1_1DeleteContactChannelCommand = async (output, context) => {
777
578
  if (output.statusCode >= 300) {
@@ -798,59 +599,28 @@ const deserializeAws_json1_1DeleteContactChannelCommandError = async (output, co
798
599
  switch (errorCode) {
799
600
  case "AccessDeniedException":
800
601
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
801
- response = {
802
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
803
- name: errorCode,
804
- $metadata: deserializeMetadata(output),
805
- };
806
- break;
602
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
807
603
  case "InternalServerException":
808
604
  case "com.amazonaws.ssmcontacts#InternalServerException":
809
- response = {
810
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
811
- name: errorCode,
812
- $metadata: deserializeMetadata(output),
813
- };
814
- break;
605
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
815
606
  case "ResourceNotFoundException":
816
607
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
817
- response = {
818
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
819
- name: errorCode,
820
- $metadata: deserializeMetadata(output),
821
- };
822
- break;
608
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
823
609
  case "ThrottlingException":
824
610
  case "com.amazonaws.ssmcontacts#ThrottlingException":
825
- response = {
826
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
827
- name: errorCode,
828
- $metadata: deserializeMetadata(output),
829
- };
830
- break;
611
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
831
612
  case "ValidationException":
832
613
  case "com.amazonaws.ssmcontacts#ValidationException":
833
- response = {
834
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
835
- name: errorCode,
836
- $metadata: deserializeMetadata(output),
837
- };
838
- break;
614
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
839
615
  default:
840
616
  const parsedBody = parsedOutput.body;
841
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
842
- response = {
843
- ...parsedBody,
844
- name: `${errorCode}`,
845
- message: parsedBody.message || parsedBody.Message || errorCode,
617
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
618
+ name: parsedBody.code || parsedBody.Code || errorCode,
846
619
  $fault: "client",
847
620
  $metadata: deserializeMetadata(output),
848
- };
621
+ });
622
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
849
623
  }
850
- const message = response.message || response.Message || errorCode;
851
- response.message = message;
852
- delete response.Message;
853
- return Promise.reject(Object.assign(new Error(message), response));
854
624
  };
855
625
  const deserializeAws_json1_1DescribeEngagementCommand = async (output, context) => {
856
626
  if (output.statusCode >= 300) {
@@ -877,67 +647,31 @@ const deserializeAws_json1_1DescribeEngagementCommandError = async (output, cont
877
647
  switch (errorCode) {
878
648
  case "AccessDeniedException":
879
649
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
880
- response = {
881
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
882
- name: errorCode,
883
- $metadata: deserializeMetadata(output),
884
- };
885
- break;
650
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
886
651
  case "DataEncryptionException":
887
652
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
888
- response = {
889
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
890
- name: errorCode,
891
- $metadata: deserializeMetadata(output),
892
- };
893
- break;
653
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
894
654
  case "InternalServerException":
895
655
  case "com.amazonaws.ssmcontacts#InternalServerException":
896
- response = {
897
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
898
- name: errorCode,
899
- $metadata: deserializeMetadata(output),
900
- };
901
- break;
656
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
902
657
  case "ResourceNotFoundException":
903
658
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
904
- response = {
905
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
906
- name: errorCode,
907
- $metadata: deserializeMetadata(output),
908
- };
909
- break;
659
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
910
660
  case "ThrottlingException":
911
661
  case "com.amazonaws.ssmcontacts#ThrottlingException":
912
- response = {
913
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
914
- name: errorCode,
915
- $metadata: deserializeMetadata(output),
916
- };
917
- break;
662
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
918
663
  case "ValidationException":
919
664
  case "com.amazonaws.ssmcontacts#ValidationException":
920
- response = {
921
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
922
- name: errorCode,
923
- $metadata: deserializeMetadata(output),
924
- };
925
- break;
665
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
926
666
  default:
927
667
  const parsedBody = parsedOutput.body;
928
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
929
- response = {
930
- ...parsedBody,
931
- name: `${errorCode}`,
932
- message: parsedBody.message || parsedBody.Message || errorCode,
668
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
669
+ name: parsedBody.code || parsedBody.Code || errorCode,
933
670
  $fault: "client",
934
671
  $metadata: deserializeMetadata(output),
935
- };
672
+ });
673
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
936
674
  }
937
- const message = response.message || response.Message || errorCode;
938
- response.message = message;
939
- delete response.Message;
940
- return Promise.reject(Object.assign(new Error(message), response));
941
675
  };
942
676
  const deserializeAws_json1_1DescribePageCommand = async (output, context) => {
943
677
  if (output.statusCode >= 300) {
@@ -964,67 +698,31 @@ const deserializeAws_json1_1DescribePageCommandError = async (output, context) =
964
698
  switch (errorCode) {
965
699
  case "AccessDeniedException":
966
700
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
967
- response = {
968
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
969
- name: errorCode,
970
- $metadata: deserializeMetadata(output),
971
- };
972
- break;
701
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
973
702
  case "DataEncryptionException":
974
703
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
975
- response = {
976
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
977
- name: errorCode,
978
- $metadata: deserializeMetadata(output),
979
- };
980
- break;
704
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
981
705
  case "InternalServerException":
982
706
  case "com.amazonaws.ssmcontacts#InternalServerException":
983
- response = {
984
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
985
- name: errorCode,
986
- $metadata: deserializeMetadata(output),
987
- };
988
- break;
707
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
989
708
  case "ResourceNotFoundException":
990
709
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
991
- response = {
992
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
993
- name: errorCode,
994
- $metadata: deserializeMetadata(output),
995
- };
996
- break;
710
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
997
711
  case "ThrottlingException":
998
712
  case "com.amazonaws.ssmcontacts#ThrottlingException":
999
- response = {
1000
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1001
- name: errorCode,
1002
- $metadata: deserializeMetadata(output),
1003
- };
1004
- break;
713
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1005
714
  case "ValidationException":
1006
715
  case "com.amazonaws.ssmcontacts#ValidationException":
1007
- response = {
1008
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1009
- name: errorCode,
1010
- $metadata: deserializeMetadata(output),
1011
- };
1012
- break;
716
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1013
717
  default:
1014
718
  const parsedBody = parsedOutput.body;
1015
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1016
- response = {
1017
- ...parsedBody,
1018
- name: `${errorCode}`,
1019
- message: parsedBody.message || parsedBody.Message || errorCode,
719
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
720
+ name: parsedBody.code || parsedBody.Code || errorCode,
1020
721
  $fault: "client",
1021
722
  $metadata: deserializeMetadata(output),
1022
- };
723
+ });
724
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1023
725
  }
1024
- const message = response.message || response.Message || errorCode;
1025
- response.message = message;
1026
- delete response.Message;
1027
- return Promise.reject(Object.assign(new Error(message), response));
1028
726
  };
1029
727
  const deserializeAws_json1_1GetContactCommand = async (output, context) => {
1030
728
  if (output.statusCode >= 300) {
@@ -1051,67 +749,31 @@ const deserializeAws_json1_1GetContactCommandError = async (output, context) =>
1051
749
  switch (errorCode) {
1052
750
  case "AccessDeniedException":
1053
751
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1054
- response = {
1055
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1056
- name: errorCode,
1057
- $metadata: deserializeMetadata(output),
1058
- };
1059
- break;
752
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1060
753
  case "DataEncryptionException":
1061
754
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
1062
- response = {
1063
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
1064
- name: errorCode,
1065
- $metadata: deserializeMetadata(output),
1066
- };
1067
- break;
755
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
1068
756
  case "InternalServerException":
1069
757
  case "com.amazonaws.ssmcontacts#InternalServerException":
1070
- response = {
1071
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1072
- name: errorCode,
1073
- $metadata: deserializeMetadata(output),
1074
- };
1075
- break;
758
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1076
759
  case "ResourceNotFoundException":
1077
760
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1078
- response = {
1079
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1080
- name: errorCode,
1081
- $metadata: deserializeMetadata(output),
1082
- };
1083
- break;
761
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1084
762
  case "ThrottlingException":
1085
763
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1086
- response = {
1087
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1088
- name: errorCode,
1089
- $metadata: deserializeMetadata(output),
1090
- };
1091
- break;
764
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1092
765
  case "ValidationException":
1093
766
  case "com.amazonaws.ssmcontacts#ValidationException":
1094
- response = {
1095
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1096
- name: errorCode,
1097
- $metadata: deserializeMetadata(output),
1098
- };
1099
- break;
767
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1100
768
  default:
1101
769
  const parsedBody = parsedOutput.body;
1102
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1103
- response = {
1104
- ...parsedBody,
1105
- name: `${errorCode}`,
1106
- message: parsedBody.message || parsedBody.Message || errorCode,
770
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
771
+ name: parsedBody.code || parsedBody.Code || errorCode,
1107
772
  $fault: "client",
1108
773
  $metadata: deserializeMetadata(output),
1109
- };
774
+ });
775
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1110
776
  }
1111
- const message = response.message || response.Message || errorCode;
1112
- response.message = message;
1113
- delete response.Message;
1114
- return Promise.reject(Object.assign(new Error(message), response));
1115
777
  };
1116
778
  const deserializeAws_json1_1GetContactChannelCommand = async (output, context) => {
1117
779
  if (output.statusCode >= 300) {
@@ -1138,67 +800,31 @@ const deserializeAws_json1_1GetContactChannelCommandError = async (output, conte
1138
800
  switch (errorCode) {
1139
801
  case "AccessDeniedException":
1140
802
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1141
- response = {
1142
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1143
- name: errorCode,
1144
- $metadata: deserializeMetadata(output),
1145
- };
1146
- break;
803
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1147
804
  case "DataEncryptionException":
1148
805
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
1149
- response = {
1150
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
1151
- name: errorCode,
1152
- $metadata: deserializeMetadata(output),
1153
- };
1154
- break;
806
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
1155
807
  case "InternalServerException":
1156
808
  case "com.amazonaws.ssmcontacts#InternalServerException":
1157
- response = {
1158
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1159
- name: errorCode,
1160
- $metadata: deserializeMetadata(output),
1161
- };
1162
- break;
809
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1163
810
  case "ResourceNotFoundException":
1164
811
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1165
- response = {
1166
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1167
- name: errorCode,
1168
- $metadata: deserializeMetadata(output),
1169
- };
1170
- break;
812
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1171
813
  case "ThrottlingException":
1172
814
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1173
- response = {
1174
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1175
- name: errorCode,
1176
- $metadata: deserializeMetadata(output),
1177
- };
1178
- break;
815
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1179
816
  case "ValidationException":
1180
817
  case "com.amazonaws.ssmcontacts#ValidationException":
1181
- response = {
1182
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1183
- name: errorCode,
1184
- $metadata: deserializeMetadata(output),
1185
- };
1186
- break;
818
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1187
819
  default:
1188
820
  const parsedBody = parsedOutput.body;
1189
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1190
- response = {
1191
- ...parsedBody,
1192
- name: `${errorCode}`,
1193
- message: parsedBody.message || parsedBody.Message || errorCode,
821
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
822
+ name: parsedBody.code || parsedBody.Code || errorCode,
1194
823
  $fault: "client",
1195
824
  $metadata: deserializeMetadata(output),
1196
- };
825
+ });
826
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1197
827
  }
1198
- const message = response.message || response.Message || errorCode;
1199
- response.message = message;
1200
- delete response.Message;
1201
- return Promise.reject(Object.assign(new Error(message), response));
1202
828
  };
1203
829
  const deserializeAws_json1_1GetContactPolicyCommand = async (output, context) => {
1204
830
  if (output.statusCode >= 300) {
@@ -1225,59 +851,28 @@ const deserializeAws_json1_1GetContactPolicyCommandError = async (output, contex
1225
851
  switch (errorCode) {
1226
852
  case "AccessDeniedException":
1227
853
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1228
- response = {
1229
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1230
- name: errorCode,
1231
- $metadata: deserializeMetadata(output),
1232
- };
1233
- break;
854
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1234
855
  case "InternalServerException":
1235
856
  case "com.amazonaws.ssmcontacts#InternalServerException":
1236
- response = {
1237
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1238
- name: errorCode,
1239
- $metadata: deserializeMetadata(output),
1240
- };
1241
- break;
857
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1242
858
  case "ResourceNotFoundException":
1243
859
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1244
- response = {
1245
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1246
- name: errorCode,
1247
- $metadata: deserializeMetadata(output),
1248
- };
1249
- break;
860
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1250
861
  case "ThrottlingException":
1251
862
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1252
- response = {
1253
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1254
- name: errorCode,
1255
- $metadata: deserializeMetadata(output),
1256
- };
1257
- break;
863
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1258
864
  case "ValidationException":
1259
865
  case "com.amazonaws.ssmcontacts#ValidationException":
1260
- response = {
1261
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1262
- name: errorCode,
1263
- $metadata: deserializeMetadata(output),
1264
- };
1265
- break;
866
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1266
867
  default:
1267
868
  const parsedBody = parsedOutput.body;
1268
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1269
- response = {
1270
- ...parsedBody,
1271
- name: `${errorCode}`,
1272
- message: parsedBody.message || parsedBody.Message || errorCode,
869
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
870
+ name: parsedBody.code || parsedBody.Code || errorCode,
1273
871
  $fault: "client",
1274
872
  $metadata: deserializeMetadata(output),
1275
- };
873
+ });
874
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1276
875
  }
1277
- const message = response.message || response.Message || errorCode;
1278
- response.message = message;
1279
- delete response.Message;
1280
- return Promise.reject(Object.assign(new Error(message), response));
1281
876
  };
1282
877
  const deserializeAws_json1_1ListContactChannelsCommand = async (output, context) => {
1283
878
  if (output.statusCode >= 300) {
@@ -1304,67 +899,31 @@ const deserializeAws_json1_1ListContactChannelsCommandError = async (output, con
1304
899
  switch (errorCode) {
1305
900
  case "AccessDeniedException":
1306
901
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1307
- response = {
1308
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1309
- name: errorCode,
1310
- $metadata: deserializeMetadata(output),
1311
- };
1312
- break;
902
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1313
903
  case "DataEncryptionException":
1314
904
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
1315
- response = {
1316
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
1317
- name: errorCode,
1318
- $metadata: deserializeMetadata(output),
1319
- };
1320
- break;
905
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
1321
906
  case "InternalServerException":
1322
907
  case "com.amazonaws.ssmcontacts#InternalServerException":
1323
- response = {
1324
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1325
- name: errorCode,
1326
- $metadata: deserializeMetadata(output),
1327
- };
1328
- break;
908
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1329
909
  case "ResourceNotFoundException":
1330
910
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1331
- response = {
1332
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1333
- name: errorCode,
1334
- $metadata: deserializeMetadata(output),
1335
- };
1336
- break;
911
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1337
912
  case "ThrottlingException":
1338
913
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1339
- response = {
1340
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1341
- name: errorCode,
1342
- $metadata: deserializeMetadata(output),
1343
- };
1344
- break;
914
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1345
915
  case "ValidationException":
1346
916
  case "com.amazonaws.ssmcontacts#ValidationException":
1347
- response = {
1348
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1349
- name: errorCode,
1350
- $metadata: deserializeMetadata(output),
1351
- };
1352
- break;
917
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1353
918
  default:
1354
919
  const parsedBody = parsedOutput.body;
1355
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1356
- response = {
1357
- ...parsedBody,
1358
- name: `${errorCode}`,
1359
- message: parsedBody.message || parsedBody.Message || errorCode,
920
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
921
+ name: parsedBody.code || parsedBody.Code || errorCode,
1360
922
  $fault: "client",
1361
923
  $metadata: deserializeMetadata(output),
1362
- };
924
+ });
925
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1363
926
  }
1364
- const message = response.message || response.Message || errorCode;
1365
- response.message = message;
1366
- delete response.Message;
1367
- return Promise.reject(Object.assign(new Error(message), response));
1368
927
  };
1369
928
  const deserializeAws_json1_1ListContactsCommand = async (output, context) => {
1370
929
  if (output.statusCode >= 300) {
@@ -1391,51 +950,25 @@ const deserializeAws_json1_1ListContactsCommandError = async (output, context) =
1391
950
  switch (errorCode) {
1392
951
  case "AccessDeniedException":
1393
952
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1394
- response = {
1395
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1396
- name: errorCode,
1397
- $metadata: deserializeMetadata(output),
1398
- };
1399
- break;
953
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1400
954
  case "InternalServerException":
1401
955
  case "com.amazonaws.ssmcontacts#InternalServerException":
1402
- response = {
1403
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1404
- name: errorCode,
1405
- $metadata: deserializeMetadata(output),
1406
- };
1407
- break;
956
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1408
957
  case "ThrottlingException":
1409
958
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1410
- response = {
1411
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1412
- name: errorCode,
1413
- $metadata: deserializeMetadata(output),
1414
- };
1415
- break;
959
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1416
960
  case "ValidationException":
1417
961
  case "com.amazonaws.ssmcontacts#ValidationException":
1418
- response = {
1419
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1420
- name: errorCode,
1421
- $metadata: deserializeMetadata(output),
1422
- };
1423
- break;
962
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1424
963
  default:
1425
964
  const parsedBody = parsedOutput.body;
1426
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1427
- response = {
1428
- ...parsedBody,
1429
- name: `${errorCode}`,
1430
- message: parsedBody.message || parsedBody.Message || errorCode,
965
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
966
+ name: parsedBody.code || parsedBody.Code || errorCode,
1431
967
  $fault: "client",
1432
968
  $metadata: deserializeMetadata(output),
1433
- };
969
+ });
970
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1434
971
  }
1435
- const message = response.message || response.Message || errorCode;
1436
- response.message = message;
1437
- delete response.Message;
1438
- return Promise.reject(Object.assign(new Error(message), response));
1439
972
  };
1440
973
  const deserializeAws_json1_1ListEngagementsCommand = async (output, context) => {
1441
974
  if (output.statusCode >= 300) {
@@ -1462,51 +995,25 @@ const deserializeAws_json1_1ListEngagementsCommandError = async (output, context
1462
995
  switch (errorCode) {
1463
996
  case "AccessDeniedException":
1464
997
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1465
- response = {
1466
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1467
- name: errorCode,
1468
- $metadata: deserializeMetadata(output),
1469
- };
1470
- break;
998
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1471
999
  case "InternalServerException":
1472
1000
  case "com.amazonaws.ssmcontacts#InternalServerException":
1473
- response = {
1474
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1475
- name: errorCode,
1476
- $metadata: deserializeMetadata(output),
1477
- };
1478
- break;
1001
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1479
1002
  case "ThrottlingException":
1480
1003
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1481
- response = {
1482
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1483
- name: errorCode,
1484
- $metadata: deserializeMetadata(output),
1485
- };
1486
- break;
1004
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1487
1005
  case "ValidationException":
1488
1006
  case "com.amazonaws.ssmcontacts#ValidationException":
1489
- response = {
1490
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1491
- name: errorCode,
1492
- $metadata: deserializeMetadata(output),
1493
- };
1494
- break;
1007
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1495
1008
  default:
1496
1009
  const parsedBody = parsedOutput.body;
1497
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1498
- response = {
1499
- ...parsedBody,
1500
- name: `${errorCode}`,
1501
- message: parsedBody.message || parsedBody.Message || errorCode,
1010
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1011
+ name: parsedBody.code || parsedBody.Code || errorCode,
1502
1012
  $fault: "client",
1503
1013
  $metadata: deserializeMetadata(output),
1504
- };
1014
+ });
1015
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1505
1016
  }
1506
- const message = response.message || response.Message || errorCode;
1507
- response.message = message;
1508
- delete response.Message;
1509
- return Promise.reject(Object.assign(new Error(message), response));
1510
1017
  };
1511
1018
  const deserializeAws_json1_1ListPageReceiptsCommand = async (output, context) => {
1512
1019
  if (output.statusCode >= 300) {
@@ -1533,59 +1040,28 @@ const deserializeAws_json1_1ListPageReceiptsCommandError = async (output, contex
1533
1040
  switch (errorCode) {
1534
1041
  case "AccessDeniedException":
1535
1042
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1536
- response = {
1537
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1538
- name: errorCode,
1539
- $metadata: deserializeMetadata(output),
1540
- };
1541
- break;
1043
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1542
1044
  case "InternalServerException":
1543
1045
  case "com.amazonaws.ssmcontacts#InternalServerException":
1544
- response = {
1545
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1546
- name: errorCode,
1547
- $metadata: deserializeMetadata(output),
1548
- };
1549
- break;
1046
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1550
1047
  case "ResourceNotFoundException":
1551
1048
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1552
- response = {
1553
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1554
- name: errorCode,
1555
- $metadata: deserializeMetadata(output),
1556
- };
1557
- break;
1049
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1558
1050
  case "ThrottlingException":
1559
1051
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1560
- response = {
1561
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1562
- name: errorCode,
1563
- $metadata: deserializeMetadata(output),
1564
- };
1565
- break;
1052
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1566
1053
  case "ValidationException":
1567
1054
  case "com.amazonaws.ssmcontacts#ValidationException":
1568
- response = {
1569
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1570
- name: errorCode,
1571
- $metadata: deserializeMetadata(output),
1572
- };
1573
- break;
1055
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1574
1056
  default:
1575
1057
  const parsedBody = parsedOutput.body;
1576
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1577
- response = {
1578
- ...parsedBody,
1579
- name: `${errorCode}`,
1580
- message: parsedBody.message || parsedBody.Message || errorCode,
1058
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1059
+ name: parsedBody.code || parsedBody.Code || errorCode,
1581
1060
  $fault: "client",
1582
1061
  $metadata: deserializeMetadata(output),
1583
- };
1062
+ });
1063
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1584
1064
  }
1585
- const message = response.message || response.Message || errorCode;
1586
- response.message = message;
1587
- delete response.Message;
1588
- return Promise.reject(Object.assign(new Error(message), response));
1589
1065
  };
1590
1066
  const deserializeAws_json1_1ListPagesByContactCommand = async (output, context) => {
1591
1067
  if (output.statusCode >= 300) {
@@ -1612,59 +1088,28 @@ const deserializeAws_json1_1ListPagesByContactCommandError = async (output, cont
1612
1088
  switch (errorCode) {
1613
1089
  case "AccessDeniedException":
1614
1090
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1615
- response = {
1616
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1617
- name: errorCode,
1618
- $metadata: deserializeMetadata(output),
1619
- };
1620
- break;
1091
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1621
1092
  case "InternalServerException":
1622
1093
  case "com.amazonaws.ssmcontacts#InternalServerException":
1623
- response = {
1624
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1625
- name: errorCode,
1626
- $metadata: deserializeMetadata(output),
1627
- };
1628
- break;
1094
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1629
1095
  case "ResourceNotFoundException":
1630
1096
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1631
- response = {
1632
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1633
- name: errorCode,
1634
- $metadata: deserializeMetadata(output),
1635
- };
1636
- break;
1097
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1637
1098
  case "ThrottlingException":
1638
1099
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1639
- response = {
1640
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1641
- name: errorCode,
1642
- $metadata: deserializeMetadata(output),
1643
- };
1644
- break;
1100
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1645
1101
  case "ValidationException":
1646
1102
  case "com.amazonaws.ssmcontacts#ValidationException":
1647
- response = {
1648
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1649
- name: errorCode,
1650
- $metadata: deserializeMetadata(output),
1651
- };
1652
- break;
1103
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1653
1104
  default:
1654
1105
  const parsedBody = parsedOutput.body;
1655
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1656
- response = {
1657
- ...parsedBody,
1658
- name: `${errorCode}`,
1659
- message: parsedBody.message || parsedBody.Message || errorCode,
1106
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1107
+ name: parsedBody.code || parsedBody.Code || errorCode,
1660
1108
  $fault: "client",
1661
1109
  $metadata: deserializeMetadata(output),
1662
- };
1110
+ });
1111
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1663
1112
  }
1664
- const message = response.message || response.Message || errorCode;
1665
- response.message = message;
1666
- delete response.Message;
1667
- return Promise.reject(Object.assign(new Error(message), response));
1668
1113
  };
1669
1114
  const deserializeAws_json1_1ListPagesByEngagementCommand = async (output, context) => {
1670
1115
  if (output.statusCode >= 300) {
@@ -1691,59 +1136,28 @@ const deserializeAws_json1_1ListPagesByEngagementCommandError = async (output, c
1691
1136
  switch (errorCode) {
1692
1137
  case "AccessDeniedException":
1693
1138
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1694
- response = {
1695
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1696
- name: errorCode,
1697
- $metadata: deserializeMetadata(output),
1698
- };
1699
- break;
1139
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1700
1140
  case "InternalServerException":
1701
1141
  case "com.amazonaws.ssmcontacts#InternalServerException":
1702
- response = {
1703
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1704
- name: errorCode,
1705
- $metadata: deserializeMetadata(output),
1706
- };
1707
- break;
1142
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1708
1143
  case "ResourceNotFoundException":
1709
1144
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1710
- response = {
1711
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1712
- name: errorCode,
1713
- $metadata: deserializeMetadata(output),
1714
- };
1715
- break;
1145
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1716
1146
  case "ThrottlingException":
1717
1147
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1718
- response = {
1719
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1720
- name: errorCode,
1721
- $metadata: deserializeMetadata(output),
1722
- };
1723
- break;
1148
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1724
1149
  case "ValidationException":
1725
1150
  case "com.amazonaws.ssmcontacts#ValidationException":
1726
- response = {
1727
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1728
- name: errorCode,
1729
- $metadata: deserializeMetadata(output),
1730
- };
1731
- break;
1151
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1732
1152
  default:
1733
1153
  const parsedBody = parsedOutput.body;
1734
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1735
- response = {
1736
- ...parsedBody,
1737
- name: `${errorCode}`,
1738
- message: parsedBody.message || parsedBody.Message || errorCode,
1154
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1155
+ name: parsedBody.code || parsedBody.Code || errorCode,
1739
1156
  $fault: "client",
1740
1157
  $metadata: deserializeMetadata(output),
1741
- };
1158
+ });
1159
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1742
1160
  }
1743
- const message = response.message || response.Message || errorCode;
1744
- response.message = message;
1745
- delete response.Message;
1746
- return Promise.reject(Object.assign(new Error(message), response));
1747
1161
  };
1748
1162
  const deserializeAws_json1_1ListTagsForResourceCommand = async (output, context) => {
1749
1163
  if (output.statusCode >= 300) {
@@ -1770,59 +1184,28 @@ const deserializeAws_json1_1ListTagsForResourceCommandError = async (output, con
1770
1184
  switch (errorCode) {
1771
1185
  case "AccessDeniedException":
1772
1186
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1773
- response = {
1774
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1775
- name: errorCode,
1776
- $metadata: deserializeMetadata(output),
1777
- };
1778
- break;
1187
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1779
1188
  case "InternalServerException":
1780
1189
  case "com.amazonaws.ssmcontacts#InternalServerException":
1781
- response = {
1782
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1783
- name: errorCode,
1784
- $metadata: deserializeMetadata(output),
1785
- };
1786
- break;
1190
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1787
1191
  case "ResourceNotFoundException":
1788
1192
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1789
- response = {
1790
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1791
- name: errorCode,
1792
- $metadata: deserializeMetadata(output),
1793
- };
1794
- break;
1193
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1795
1194
  case "ThrottlingException":
1796
1195
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1797
- response = {
1798
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1799
- name: errorCode,
1800
- $metadata: deserializeMetadata(output),
1801
- };
1802
- break;
1196
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1803
1197
  case "ValidationException":
1804
1198
  case "com.amazonaws.ssmcontacts#ValidationException":
1805
- response = {
1806
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1807
- name: errorCode,
1808
- $metadata: deserializeMetadata(output),
1809
- };
1810
- break;
1199
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1811
1200
  default:
1812
1201
  const parsedBody = parsedOutput.body;
1813
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1814
- response = {
1815
- ...parsedBody,
1816
- name: `${errorCode}`,
1817
- message: parsedBody.message || parsedBody.Message || errorCode,
1202
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1203
+ name: parsedBody.code || parsedBody.Code || errorCode,
1818
1204
  $fault: "client",
1819
1205
  $metadata: deserializeMetadata(output),
1820
- };
1206
+ });
1207
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1821
1208
  }
1822
- const message = response.message || response.Message || errorCode;
1823
- response.message = message;
1824
- delete response.Message;
1825
- return Promise.reject(Object.assign(new Error(message), response));
1826
1209
  };
1827
1210
  const deserializeAws_json1_1PutContactPolicyCommand = async (output, context) => {
1828
1211
  if (output.statusCode >= 300) {
@@ -1849,67 +1232,31 @@ const deserializeAws_json1_1PutContactPolicyCommandError = async (output, contex
1849
1232
  switch (errorCode) {
1850
1233
  case "AccessDeniedException":
1851
1234
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1852
- response = {
1853
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1854
- name: errorCode,
1855
- $metadata: deserializeMetadata(output),
1856
- };
1857
- break;
1235
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1858
1236
  case "ConflictException":
1859
1237
  case "com.amazonaws.ssmcontacts#ConflictException":
1860
- response = {
1861
- ...(await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context)),
1862
- name: errorCode,
1863
- $metadata: deserializeMetadata(output),
1864
- };
1865
- break;
1238
+ throw await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context);
1866
1239
  case "InternalServerException":
1867
1240
  case "com.amazonaws.ssmcontacts#InternalServerException":
1868
- response = {
1869
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1870
- name: errorCode,
1871
- $metadata: deserializeMetadata(output),
1872
- };
1873
- break;
1241
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1874
1242
  case "ResourceNotFoundException":
1875
1243
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1876
- response = {
1877
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1878
- name: errorCode,
1879
- $metadata: deserializeMetadata(output),
1880
- };
1881
- break;
1244
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1882
1245
  case "ThrottlingException":
1883
1246
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1884
- response = {
1885
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1886
- name: errorCode,
1887
- $metadata: deserializeMetadata(output),
1888
- };
1889
- break;
1247
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1890
1248
  case "ValidationException":
1891
1249
  case "com.amazonaws.ssmcontacts#ValidationException":
1892
- response = {
1893
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1894
- name: errorCode,
1895
- $metadata: deserializeMetadata(output),
1896
- };
1897
- break;
1250
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1898
1251
  default:
1899
1252
  const parsedBody = parsedOutput.body;
1900
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1901
- response = {
1902
- ...parsedBody,
1903
- name: `${errorCode}`,
1904
- message: parsedBody.message || parsedBody.Message || errorCode,
1253
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1254
+ name: parsedBody.code || parsedBody.Code || errorCode,
1905
1255
  $fault: "client",
1906
1256
  $metadata: deserializeMetadata(output),
1907
- };
1257
+ });
1258
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1908
1259
  }
1909
- const message = response.message || response.Message || errorCode;
1910
- response.message = message;
1911
- delete response.Message;
1912
- return Promise.reject(Object.assign(new Error(message), response));
1913
1260
  };
1914
1261
  const deserializeAws_json1_1SendActivationCodeCommand = async (output, context) => {
1915
1262
  if (output.statusCode >= 300) {
@@ -1936,75 +1283,34 @@ const deserializeAws_json1_1SendActivationCodeCommandError = async (output, cont
1936
1283
  switch (errorCode) {
1937
1284
  case "AccessDeniedException":
1938
1285
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
1939
- response = {
1940
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
1941
- name: errorCode,
1942
- $metadata: deserializeMetadata(output),
1943
- };
1944
- break;
1286
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
1945
1287
  case "DataEncryptionException":
1946
1288
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
1947
- response = {
1948
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
1949
- name: errorCode,
1950
- $metadata: deserializeMetadata(output),
1951
- };
1952
- break;
1289
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
1953
1290
  case "InternalServerException":
1954
1291
  case "com.amazonaws.ssmcontacts#InternalServerException":
1955
- response = {
1956
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
1957
- name: errorCode,
1958
- $metadata: deserializeMetadata(output),
1959
- };
1960
- break;
1292
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
1961
1293
  case "ResourceNotFoundException":
1962
1294
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
1963
- response = {
1964
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1965
- name: errorCode,
1966
- $metadata: deserializeMetadata(output),
1967
- };
1968
- break;
1295
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1969
1296
  case "ServiceQuotaExceededException":
1970
1297
  case "com.amazonaws.ssmcontacts#ServiceQuotaExceededException":
1971
- response = {
1972
- ...(await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1973
- name: errorCode,
1974
- $metadata: deserializeMetadata(output),
1975
- };
1976
- break;
1298
+ throw await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
1977
1299
  case "ThrottlingException":
1978
1300
  case "com.amazonaws.ssmcontacts#ThrottlingException":
1979
- response = {
1980
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1981
- name: errorCode,
1982
- $metadata: deserializeMetadata(output),
1983
- };
1984
- break;
1301
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1985
1302
  case "ValidationException":
1986
1303
  case "com.amazonaws.ssmcontacts#ValidationException":
1987
- response = {
1988
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
1989
- name: errorCode,
1990
- $metadata: deserializeMetadata(output),
1991
- };
1992
- break;
1304
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
1993
1305
  default:
1994
1306
  const parsedBody = parsedOutput.body;
1995
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1996
- response = {
1997
- ...parsedBody,
1998
- name: `${errorCode}`,
1999
- message: parsedBody.message || parsedBody.Message || errorCode,
1307
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1308
+ name: parsedBody.code || parsedBody.Code || errorCode,
2000
1309
  $fault: "client",
2001
1310
  $metadata: deserializeMetadata(output),
2002
- };
1311
+ });
1312
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2003
1313
  }
2004
- const message = response.message || response.Message || errorCode;
2005
- response.message = message;
2006
- delete response.Message;
2007
- return Promise.reject(Object.assign(new Error(message), response));
2008
1314
  };
2009
1315
  const deserializeAws_json1_1StartEngagementCommand = async (output, context) => {
2010
1316
  if (output.statusCode >= 300) {
@@ -2031,67 +1337,31 @@ const deserializeAws_json1_1StartEngagementCommandError = async (output, context
2031
1337
  switch (errorCode) {
2032
1338
  case "AccessDeniedException":
2033
1339
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2034
- response = {
2035
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2036
- name: errorCode,
2037
- $metadata: deserializeMetadata(output),
2038
- };
2039
- break;
1340
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2040
1341
  case "DataEncryptionException":
2041
1342
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
2042
- response = {
2043
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
2044
- name: errorCode,
2045
- $metadata: deserializeMetadata(output),
2046
- };
2047
- break;
1343
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
2048
1344
  case "InternalServerException":
2049
1345
  case "com.amazonaws.ssmcontacts#InternalServerException":
2050
- response = {
2051
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2052
- name: errorCode,
2053
- $metadata: deserializeMetadata(output),
2054
- };
2055
- break;
1346
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2056
1347
  case "ResourceNotFoundException":
2057
1348
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2058
- response = {
2059
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2060
- name: errorCode,
2061
- $metadata: deserializeMetadata(output),
2062
- };
2063
- break;
1349
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2064
1350
  case "ThrottlingException":
2065
1351
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2066
- response = {
2067
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2068
- name: errorCode,
2069
- $metadata: deserializeMetadata(output),
2070
- };
2071
- break;
1352
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2072
1353
  case "ValidationException":
2073
1354
  case "com.amazonaws.ssmcontacts#ValidationException":
2074
- response = {
2075
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2076
- name: errorCode,
2077
- $metadata: deserializeMetadata(output),
2078
- };
2079
- break;
1355
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2080
1356
  default:
2081
1357
  const parsedBody = parsedOutput.body;
2082
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2083
- response = {
2084
- ...parsedBody,
2085
- name: `${errorCode}`,
2086
- message: parsedBody.message || parsedBody.Message || errorCode,
1358
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1359
+ name: parsedBody.code || parsedBody.Code || errorCode,
2087
1360
  $fault: "client",
2088
1361
  $metadata: deserializeMetadata(output),
2089
- };
1362
+ });
1363
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2090
1364
  }
2091
- const message = response.message || response.Message || errorCode;
2092
- response.message = message;
2093
- delete response.Message;
2094
- return Promise.reject(Object.assign(new Error(message), response));
2095
1365
  };
2096
1366
  const deserializeAws_json1_1StopEngagementCommand = async (output, context) => {
2097
1367
  if (output.statusCode >= 300) {
@@ -2118,59 +1388,28 @@ const deserializeAws_json1_1StopEngagementCommandError = async (output, context)
2118
1388
  switch (errorCode) {
2119
1389
  case "AccessDeniedException":
2120
1390
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2121
- response = {
2122
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2123
- name: errorCode,
2124
- $metadata: deserializeMetadata(output),
2125
- };
2126
- break;
1391
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2127
1392
  case "InternalServerException":
2128
1393
  case "com.amazonaws.ssmcontacts#InternalServerException":
2129
- response = {
2130
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2131
- name: errorCode,
2132
- $metadata: deserializeMetadata(output),
2133
- };
2134
- break;
1394
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2135
1395
  case "ResourceNotFoundException":
2136
1396
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2137
- response = {
2138
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2139
- name: errorCode,
2140
- $metadata: deserializeMetadata(output),
2141
- };
2142
- break;
1397
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2143
1398
  case "ThrottlingException":
2144
1399
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2145
- response = {
2146
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2147
- name: errorCode,
2148
- $metadata: deserializeMetadata(output),
2149
- };
2150
- break;
1400
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2151
1401
  case "ValidationException":
2152
1402
  case "com.amazonaws.ssmcontacts#ValidationException":
2153
- response = {
2154
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2155
- name: errorCode,
2156
- $metadata: deserializeMetadata(output),
2157
- };
2158
- break;
1403
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2159
1404
  default:
2160
1405
  const parsedBody = parsedOutput.body;
2161
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2162
- response = {
2163
- ...parsedBody,
2164
- name: `${errorCode}`,
2165
- message: parsedBody.message || parsedBody.Message || errorCode,
1406
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1407
+ name: parsedBody.code || parsedBody.Code || errorCode,
2166
1408
  $fault: "client",
2167
1409
  $metadata: deserializeMetadata(output),
2168
- };
1410
+ });
1411
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2169
1412
  }
2170
- const message = response.message || response.Message || errorCode;
2171
- response.message = message;
2172
- delete response.Message;
2173
- return Promise.reject(Object.assign(new Error(message), response));
2174
1413
  };
2175
1414
  const deserializeAws_json1_1TagResourceCommand = async (output, context) => {
2176
1415
  if (output.statusCode >= 300) {
@@ -2197,67 +1436,31 @@ const deserializeAws_json1_1TagResourceCommandError = async (output, context) =>
2197
1436
  switch (errorCode) {
2198
1437
  case "AccessDeniedException":
2199
1438
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2200
- response = {
2201
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2202
- name: errorCode,
2203
- $metadata: deserializeMetadata(output),
2204
- };
2205
- break;
1439
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2206
1440
  case "InternalServerException":
2207
1441
  case "com.amazonaws.ssmcontacts#InternalServerException":
2208
- response = {
2209
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2210
- name: errorCode,
2211
- $metadata: deserializeMetadata(output),
2212
- };
2213
- break;
1442
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2214
1443
  case "ResourceNotFoundException":
2215
1444
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2216
- response = {
2217
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2218
- name: errorCode,
2219
- $metadata: deserializeMetadata(output),
2220
- };
2221
- break;
1445
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2222
1446
  case "ServiceQuotaExceededException":
2223
1447
  case "com.amazonaws.ssmcontacts#ServiceQuotaExceededException":
2224
- response = {
2225
- ...(await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
2226
- name: errorCode,
2227
- $metadata: deserializeMetadata(output),
2228
- };
2229
- break;
1448
+ throw await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
2230
1449
  case "ThrottlingException":
2231
1450
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2232
- response = {
2233
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2234
- name: errorCode,
2235
- $metadata: deserializeMetadata(output),
2236
- };
2237
- break;
1451
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2238
1452
  case "ValidationException":
2239
1453
  case "com.amazonaws.ssmcontacts#ValidationException":
2240
- response = {
2241
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2242
- name: errorCode,
2243
- $metadata: deserializeMetadata(output),
2244
- };
2245
- break;
1454
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2246
1455
  default:
2247
1456
  const parsedBody = parsedOutput.body;
2248
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2249
- response = {
2250
- ...parsedBody,
2251
- name: `${errorCode}`,
2252
- message: parsedBody.message || parsedBody.Message || errorCode,
1457
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1458
+ name: parsedBody.code || parsedBody.Code || errorCode,
2253
1459
  $fault: "client",
2254
1460
  $metadata: deserializeMetadata(output),
2255
- };
1461
+ });
1462
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2256
1463
  }
2257
- const message = response.message || response.Message || errorCode;
2258
- response.message = message;
2259
- delete response.Message;
2260
- return Promise.reject(Object.assign(new Error(message), response));
2261
1464
  };
2262
1465
  const deserializeAws_json1_1UntagResourceCommand = async (output, context) => {
2263
1466
  if (output.statusCode >= 300) {
@@ -2284,59 +1487,28 @@ const deserializeAws_json1_1UntagResourceCommandError = async (output, context)
2284
1487
  switch (errorCode) {
2285
1488
  case "AccessDeniedException":
2286
1489
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2287
- response = {
2288
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2289
- name: errorCode,
2290
- $metadata: deserializeMetadata(output),
2291
- };
2292
- break;
1490
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2293
1491
  case "InternalServerException":
2294
1492
  case "com.amazonaws.ssmcontacts#InternalServerException":
2295
- response = {
2296
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2297
- name: errorCode,
2298
- $metadata: deserializeMetadata(output),
2299
- };
2300
- break;
1493
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2301
1494
  case "ResourceNotFoundException":
2302
1495
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2303
- response = {
2304
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2305
- name: errorCode,
2306
- $metadata: deserializeMetadata(output),
2307
- };
2308
- break;
1496
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2309
1497
  case "ThrottlingException":
2310
1498
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2311
- response = {
2312
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2313
- name: errorCode,
2314
- $metadata: deserializeMetadata(output),
2315
- };
2316
- break;
1499
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2317
1500
  case "ValidationException":
2318
1501
  case "com.amazonaws.ssmcontacts#ValidationException":
2319
- response = {
2320
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2321
- name: errorCode,
2322
- $metadata: deserializeMetadata(output),
2323
- };
2324
- break;
1502
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2325
1503
  default:
2326
1504
  const parsedBody = parsedOutput.body;
2327
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2328
- response = {
2329
- ...parsedBody,
2330
- name: `${errorCode}`,
2331
- message: parsedBody.message || parsedBody.Message || errorCode,
1505
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1506
+ name: parsedBody.code || parsedBody.Code || errorCode,
2332
1507
  $fault: "client",
2333
1508
  $metadata: deserializeMetadata(output),
2334
- };
1509
+ });
1510
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2335
1511
  }
2336
- const message = response.message || response.Message || errorCode;
2337
- response.message = message;
2338
- delete response.Message;
2339
- return Promise.reject(Object.assign(new Error(message), response));
2340
1512
  };
2341
1513
  const deserializeAws_json1_1UpdateContactCommand = async (output, context) => {
2342
1514
  if (output.statusCode >= 300) {
@@ -2363,75 +1535,34 @@ const deserializeAws_json1_1UpdateContactCommandError = async (output, context)
2363
1535
  switch (errorCode) {
2364
1536
  case "AccessDeniedException":
2365
1537
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2366
- response = {
2367
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2368
- name: errorCode,
2369
- $metadata: deserializeMetadata(output),
2370
- };
2371
- break;
1538
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2372
1539
  case "DataEncryptionException":
2373
1540
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
2374
- response = {
2375
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
2376
- name: errorCode,
2377
- $metadata: deserializeMetadata(output),
2378
- };
2379
- break;
1541
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
2380
1542
  case "InternalServerException":
2381
1543
  case "com.amazonaws.ssmcontacts#InternalServerException":
2382
- response = {
2383
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2384
- name: errorCode,
2385
- $metadata: deserializeMetadata(output),
2386
- };
2387
- break;
1544
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2388
1545
  case "ResourceNotFoundException":
2389
1546
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2390
- response = {
2391
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2392
- name: errorCode,
2393
- $metadata: deserializeMetadata(output),
2394
- };
2395
- break;
1547
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2396
1548
  case "ServiceQuotaExceededException":
2397
1549
  case "com.amazonaws.ssmcontacts#ServiceQuotaExceededException":
2398
- response = {
2399
- ...(await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
2400
- name: errorCode,
2401
- $metadata: deserializeMetadata(output),
2402
- };
2403
- break;
1550
+ throw await deserializeAws_json1_1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
2404
1551
  case "ThrottlingException":
2405
1552
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2406
- response = {
2407
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2408
- name: errorCode,
2409
- $metadata: deserializeMetadata(output),
2410
- };
2411
- break;
1553
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2412
1554
  case "ValidationException":
2413
1555
  case "com.amazonaws.ssmcontacts#ValidationException":
2414
- response = {
2415
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2416
- name: errorCode,
2417
- $metadata: deserializeMetadata(output),
2418
- };
2419
- break;
1556
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2420
1557
  default:
2421
1558
  const parsedBody = parsedOutput.body;
2422
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2423
- response = {
2424
- ...parsedBody,
2425
- name: `${errorCode}`,
2426
- message: parsedBody.message || parsedBody.Message || errorCode,
1559
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1560
+ name: parsedBody.code || parsedBody.Code || errorCode,
2427
1561
  $fault: "client",
2428
1562
  $metadata: deserializeMetadata(output),
2429
- };
1563
+ });
1564
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2430
1565
  }
2431
- const message = response.message || response.Message || errorCode;
2432
- response.message = message;
2433
- delete response.Message;
2434
- return Promise.reject(Object.assign(new Error(message), response));
2435
1566
  };
2436
1567
  const deserializeAws_json1_1UpdateContactChannelCommand = async (output, context) => {
2437
1568
  if (output.statusCode >= 300) {
@@ -2458,163 +1589,106 @@ const deserializeAws_json1_1UpdateContactChannelCommandError = async (output, co
2458
1589
  switch (errorCode) {
2459
1590
  case "AccessDeniedException":
2460
1591
  case "com.amazonaws.ssmcontacts#AccessDeniedException":
2461
- response = {
2462
- ...(await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context)),
2463
- name: errorCode,
2464
- $metadata: deserializeMetadata(output),
2465
- };
2466
- break;
1592
+ throw await deserializeAws_json1_1AccessDeniedExceptionResponse(parsedOutput, context);
2467
1593
  case "ConflictException":
2468
1594
  case "com.amazonaws.ssmcontacts#ConflictException":
2469
- response = {
2470
- ...(await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context)),
2471
- name: errorCode,
2472
- $metadata: deserializeMetadata(output),
2473
- };
2474
- break;
1595
+ throw await deserializeAws_json1_1ConflictExceptionResponse(parsedOutput, context);
2475
1596
  case "DataEncryptionException":
2476
1597
  case "com.amazonaws.ssmcontacts#DataEncryptionException":
2477
- response = {
2478
- ...(await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context)),
2479
- name: errorCode,
2480
- $metadata: deserializeMetadata(output),
2481
- };
2482
- break;
1598
+ throw await deserializeAws_json1_1DataEncryptionExceptionResponse(parsedOutput, context);
2483
1599
  case "InternalServerException":
2484
1600
  case "com.amazonaws.ssmcontacts#InternalServerException":
2485
- response = {
2486
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
2487
- name: errorCode,
2488
- $metadata: deserializeMetadata(output),
2489
- };
2490
- break;
1601
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
2491
1602
  case "ResourceNotFoundException":
2492
1603
  case "com.amazonaws.ssmcontacts#ResourceNotFoundException":
2493
- response = {
2494
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2495
- name: errorCode,
2496
- $metadata: deserializeMetadata(output),
2497
- };
2498
- break;
1604
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2499
1605
  case "ThrottlingException":
2500
1606
  case "com.amazonaws.ssmcontacts#ThrottlingException":
2501
- response = {
2502
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2503
- name: errorCode,
2504
- $metadata: deserializeMetadata(output),
2505
- };
2506
- break;
1607
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2507
1608
  case "ValidationException":
2508
1609
  case "com.amazonaws.ssmcontacts#ValidationException":
2509
- response = {
2510
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
2511
- name: errorCode,
2512
- $metadata: deserializeMetadata(output),
2513
- };
2514
- break;
1610
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
2515
1611
  default:
2516
1612
  const parsedBody = parsedOutput.body;
2517
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2518
- response = {
2519
- ...parsedBody,
2520
- name: `${errorCode}`,
2521
- message: parsedBody.message || parsedBody.Message || errorCode,
1613
+ response = new SSMContactsServiceException_1.SSMContactsServiceException({
1614
+ name: parsedBody.code || parsedBody.Code || errorCode,
2522
1615
  $fault: "client",
2523
1616
  $metadata: deserializeMetadata(output),
2524
- };
1617
+ });
1618
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2525
1619
  }
2526
- const message = response.message || response.Message || errorCode;
2527
- response.message = message;
2528
- delete response.Message;
2529
- return Promise.reject(Object.assign(new Error(message), response));
2530
1620
  };
2531
1621
  const deserializeAws_json1_1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2532
1622
  const body = parsedOutput.body;
2533
1623
  const deserialized = deserializeAws_json1_1AccessDeniedException(body, context);
2534
- const contents = {
2535
- name: "AccessDeniedException",
2536
- $fault: "client",
1624
+ const exception = new models_0_1.AccessDeniedException({
2537
1625
  $metadata: deserializeMetadata(parsedOutput),
2538
1626
  ...deserialized,
2539
- };
2540
- return contents;
1627
+ });
1628
+ return smithy_client_1.decorateServiceException(exception, body);
2541
1629
  };
2542
1630
  const deserializeAws_json1_1ConflictExceptionResponse = async (parsedOutput, context) => {
2543
1631
  const body = parsedOutput.body;
2544
1632
  const deserialized = deserializeAws_json1_1ConflictException(body, context);
2545
- const contents = {
2546
- name: "ConflictException",
2547
- $fault: "client",
1633
+ const exception = new models_0_1.ConflictException({
2548
1634
  $metadata: deserializeMetadata(parsedOutput),
2549
1635
  ...deserialized,
2550
- };
2551
- return contents;
1636
+ });
1637
+ return smithy_client_1.decorateServiceException(exception, body);
2552
1638
  };
2553
1639
  const deserializeAws_json1_1DataEncryptionExceptionResponse = async (parsedOutput, context) => {
2554
1640
  const body = parsedOutput.body;
2555
1641
  const deserialized = deserializeAws_json1_1DataEncryptionException(body, context);
2556
- const contents = {
2557
- name: "DataEncryptionException",
2558
- $fault: "client",
1642
+ const exception = new models_0_1.DataEncryptionException({
2559
1643
  $metadata: deserializeMetadata(parsedOutput),
2560
1644
  ...deserialized,
2561
- };
2562
- return contents;
1645
+ });
1646
+ return smithy_client_1.decorateServiceException(exception, body);
2563
1647
  };
2564
1648
  const deserializeAws_json1_1InternalServerExceptionResponse = async (parsedOutput, context) => {
2565
1649
  const body = parsedOutput.body;
2566
1650
  const deserialized = deserializeAws_json1_1InternalServerException(body, context);
2567
- const contents = {
2568
- name: "InternalServerException",
2569
- $fault: "server",
1651
+ const exception = new models_0_1.InternalServerException({
2570
1652
  $metadata: deserializeMetadata(parsedOutput),
2571
1653
  ...deserialized,
2572
- };
2573
- return contents;
1654
+ });
1655
+ return smithy_client_1.decorateServiceException(exception, body);
2574
1656
  };
2575
1657
  const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2576
1658
  const body = parsedOutput.body;
2577
1659
  const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
2578
- const contents = {
2579
- name: "ResourceNotFoundException",
2580
- $fault: "client",
1660
+ const exception = new models_0_1.ResourceNotFoundException({
2581
1661
  $metadata: deserializeMetadata(parsedOutput),
2582
1662
  ...deserialized,
2583
- };
2584
- return contents;
1663
+ });
1664
+ return smithy_client_1.decorateServiceException(exception, body);
2585
1665
  };
2586
1666
  const deserializeAws_json1_1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2587
1667
  const body = parsedOutput.body;
2588
1668
  const deserialized = deserializeAws_json1_1ServiceQuotaExceededException(body, context);
2589
- const contents = {
2590
- name: "ServiceQuotaExceededException",
2591
- $fault: "client",
1669
+ const exception = new models_0_1.ServiceQuotaExceededException({
2592
1670
  $metadata: deserializeMetadata(parsedOutput),
2593
1671
  ...deserialized,
2594
- };
2595
- return contents;
1672
+ });
1673
+ return smithy_client_1.decorateServiceException(exception, body);
2596
1674
  };
2597
1675
  const deserializeAws_json1_1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2598
1676
  const body = parsedOutput.body;
2599
1677
  const deserialized = deserializeAws_json1_1ThrottlingException(body, context);
2600
- const contents = {
2601
- name: "ThrottlingException",
2602
- $fault: "client",
1678
+ const exception = new models_0_1.ThrottlingException({
2603
1679
  $metadata: deserializeMetadata(parsedOutput),
2604
1680
  ...deserialized,
2605
- };
2606
- return contents;
1681
+ });
1682
+ return smithy_client_1.decorateServiceException(exception, body);
2607
1683
  };
2608
1684
  const deserializeAws_json1_1ValidationExceptionResponse = async (parsedOutput, context) => {
2609
1685
  const body = parsedOutput.body;
2610
1686
  const deserialized = deserializeAws_json1_1ValidationException(body, context);
2611
- const contents = {
2612
- name: "ValidationException",
2613
- $fault: "client",
1687
+ const exception = new models_0_1.ValidationException({
2614
1688
  $metadata: deserializeMetadata(parsedOutput),
2615
1689
  ...deserialized,
2616
- };
2617
- return contents;
1690
+ });
1691
+ return smithy_client_1.decorateServiceException(exception, body);
2618
1692
  };
2619
1693
  const serializeAws_json1_1AcceptPageRequest = (input, context) => {
2620
1694
  return {
@@ -2968,7 +2042,7 @@ const deserializeAws_json1_1ContactChannelAddress = (output, context) => {
2968
2042
  };
2969
2043
  };
2970
2044
  const deserializeAws_json1_1ContactChannelList = (output, context) => {
2971
- return (output || [])
2045
+ const retVal = (output || [])
2972
2046
  .filter((e) => e != null)
2973
2047
  .map((entry) => {
2974
2048
  if (entry === null) {
@@ -2976,9 +2050,10 @@ const deserializeAws_json1_1ContactChannelList = (output, context) => {
2976
2050
  }
2977
2051
  return deserializeAws_json1_1ContactChannel(entry, context);
2978
2052
  });
2053
+ return retVal;
2979
2054
  };
2980
2055
  const deserializeAws_json1_1ContactsList = (output, context) => {
2981
- return (output || [])
2056
+ const retVal = (output || [])
2982
2057
  .filter((e) => e != null)
2983
2058
  .map((entry) => {
2984
2059
  if (entry === null) {
@@ -2986,6 +2061,7 @@ const deserializeAws_json1_1ContactsList = (output, context) => {
2986
2061
  }
2987
2062
  return deserializeAws_json1_1Contact(entry, context);
2988
2063
  });
2064
+ return retVal;
2989
2065
  };
2990
2066
  const deserializeAws_json1_1ContactTargetInfo = (output, context) => {
2991
2067
  return {
@@ -3072,7 +2148,7 @@ const deserializeAws_json1_1Engagement = (output, context) => {
3072
2148
  };
3073
2149
  };
3074
2150
  const deserializeAws_json1_1EngagementsList = (output, context) => {
3075
- return (output || [])
2151
+ const retVal = (output || [])
3076
2152
  .filter((e) => e != null)
3077
2153
  .map((entry) => {
3078
2154
  if (entry === null) {
@@ -3080,6 +2156,7 @@ const deserializeAws_json1_1EngagementsList = (output, context) => {
3080
2156
  }
3081
2157
  return deserializeAws_json1_1Engagement(entry, context);
3082
2158
  });
2159
+ return retVal;
3083
2160
  };
3084
2161
  const deserializeAws_json1_1GetContactChannelResult = (output, context) => {
3085
2162
  return {
@@ -3188,7 +2265,7 @@ const deserializeAws_json1_1Page = (output, context) => {
3188
2265
  };
3189
2266
  };
3190
2267
  const deserializeAws_json1_1PagesList = (output, context) => {
3191
- return (output || [])
2268
+ const retVal = (output || [])
3192
2269
  .filter((e) => e != null)
3193
2270
  .map((entry) => {
3194
2271
  if (entry === null) {
@@ -3196,6 +2273,7 @@ const deserializeAws_json1_1PagesList = (output, context) => {
3196
2273
  }
3197
2274
  return deserializeAws_json1_1Page(entry, context);
3198
2275
  });
2276
+ return retVal;
3199
2277
  };
3200
2278
  const deserializeAws_json1_1Plan = (output, context) => {
3201
2279
  return {
@@ -3218,7 +2296,7 @@ const deserializeAws_json1_1Receipt = (output, context) => {
3218
2296
  };
3219
2297
  };
3220
2298
  const deserializeAws_json1_1ReceiptsList = (output, context) => {
3221
- return (output || [])
2299
+ const retVal = (output || [])
3222
2300
  .filter((e) => e != null)
3223
2301
  .map((entry) => {
3224
2302
  if (entry === null) {
@@ -3226,6 +2304,7 @@ const deserializeAws_json1_1ReceiptsList = (output, context) => {
3226
2304
  }
3227
2305
  return deserializeAws_json1_1Receipt(entry, context);
3228
2306
  });
2307
+ return retVal;
3229
2308
  };
3230
2309
  const deserializeAws_json1_1ResourceNotFoundException = (output, context) => {
3231
2310
  return {
@@ -3255,7 +2334,7 @@ const deserializeAws_json1_1Stage = (output, context) => {
3255
2334
  };
3256
2335
  };
3257
2336
  const deserializeAws_json1_1StagesList = (output, context) => {
3258
- return (output || [])
2337
+ const retVal = (output || [])
3259
2338
  .filter((e) => e != null)
3260
2339
  .map((entry) => {
3261
2340
  if (entry === null) {
@@ -3263,6 +2342,7 @@ const deserializeAws_json1_1StagesList = (output, context) => {
3263
2342
  }
3264
2343
  return deserializeAws_json1_1Stage(entry, context);
3265
2344
  });
2345
+ return retVal;
3266
2346
  };
3267
2347
  const deserializeAws_json1_1StartEngagementResult = (output, context) => {
3268
2348
  return {
@@ -3282,7 +2362,7 @@ const deserializeAws_json1_1TagResourceResult = (output, context) => {
3282
2362
  return {};
3283
2363
  };
3284
2364
  const deserializeAws_json1_1TagsList = (output, context) => {
3285
- return (output || [])
2365
+ const retVal = (output || [])
3286
2366
  .filter((e) => e != null)
3287
2367
  .map((entry) => {
3288
2368
  if (entry === null) {
@@ -3290,6 +2370,7 @@ const deserializeAws_json1_1TagsList = (output, context) => {
3290
2370
  }
3291
2371
  return deserializeAws_json1_1Tag(entry, context);
3292
2372
  });
2373
+ return retVal;
3293
2374
  };
3294
2375
  const deserializeAws_json1_1Target = (output, context) => {
3295
2376
  return {
@@ -3302,7 +2383,7 @@ const deserializeAws_json1_1Target = (output, context) => {
3302
2383
  };
3303
2384
  };
3304
2385
  const deserializeAws_json1_1TargetsList = (output, context) => {
3305
- return (output || [])
2386
+ const retVal = (output || [])
3306
2387
  .filter((e) => e != null)
3307
2388
  .map((entry) => {
3308
2389
  if (entry === null) {
@@ -3310,6 +2391,7 @@ const deserializeAws_json1_1TargetsList = (output, context) => {
3310
2391
  }
3311
2392
  return deserializeAws_json1_1Target(entry, context);
3312
2393
  });
2394
+ return retVal;
3313
2395
  };
3314
2396
  const deserializeAws_json1_1ThrottlingException = (output, context) => {
3315
2397
  return {
@@ -3344,7 +2426,7 @@ const deserializeAws_json1_1ValidationExceptionField = (output, context) => {
3344
2426
  };
3345
2427
  };
3346
2428
  const deserializeAws_json1_1ValidationExceptionFieldList = (output, context) => {
3347
- return (output || [])
2429
+ const retVal = (output || [])
3348
2430
  .filter((e) => e != null)
3349
2431
  .map((entry) => {
3350
2432
  if (entry === null) {
@@ -3352,6 +2434,7 @@ const deserializeAws_json1_1ValidationExceptionFieldList = (output, context) =>
3352
2434
  }
3353
2435
  return deserializeAws_json1_1ValidationExceptionField(entry, context);
3354
2436
  });
2437
+ return retVal;
3355
2438
  };
3356
2439
  const deserializeMetadata = (output) => {
3357
2440
  var _a;