@aws-sdk/client-iotthingsgraph 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.
@@ -4,6 +4,8 @@ exports.deserializeAws_json1_1GetFlowTemplateCommand = exports.deserializeAws_js
4
4
  exports.deserializeAws_json1_1UploadEntityDefinitionsCommand = exports.deserializeAws_json1_1UpdateSystemTemplateCommand = exports.deserializeAws_json1_1UpdateFlowTemplateCommand = exports.deserializeAws_json1_1UntagResourceCommand = exports.deserializeAws_json1_1UndeploySystemInstanceCommand = exports.deserializeAws_json1_1TagResourceCommand = exports.deserializeAws_json1_1SearchThingsCommand = exports.deserializeAws_json1_1SearchSystemTemplatesCommand = exports.deserializeAws_json1_1SearchSystemInstancesCommand = exports.deserializeAws_json1_1SearchFlowTemplatesCommand = exports.deserializeAws_json1_1SearchFlowExecutionsCommand = exports.deserializeAws_json1_1SearchEntitiesCommand = exports.deserializeAws_json1_1ListTagsForResourceCommand = exports.deserializeAws_json1_1ListFlowExecutionMessagesCommand = exports.deserializeAws_json1_1GetUploadStatusCommand = exports.deserializeAws_json1_1GetSystemTemplateRevisionsCommand = exports.deserializeAws_json1_1GetSystemTemplateCommand = exports.deserializeAws_json1_1GetSystemInstanceCommand = exports.deserializeAws_json1_1GetNamespaceDeletionStatusCommand = exports.deserializeAws_json1_1GetFlowTemplateRevisionsCommand = void 0;
5
5
  const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
+ const IoTThingsGraphServiceException_1 = require("../models/IoTThingsGraphServiceException");
8
+ const models_0_1 = require("../models/models_0");
7
9
  const serializeAws_json1_1AssociateEntityToThingCommand = async (input, context) => {
8
10
  const headers = {
9
11
  "content-type": "application/x-amz-json-1.1",
@@ -379,51 +381,25 @@ const deserializeAws_json1_1AssociateEntityToThingCommandError = async (output,
379
381
  switch (errorCode) {
380
382
  case "InternalFailureException":
381
383
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
382
- response = {
383
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
384
- name: errorCode,
385
- $metadata: deserializeMetadata(output),
386
- };
387
- break;
384
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
388
385
  case "InvalidRequestException":
389
386
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
390
- response = {
391
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
392
- name: errorCode,
393
- $metadata: deserializeMetadata(output),
394
- };
395
- break;
387
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
396
388
  case "ResourceNotFoundException":
397
389
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
398
- response = {
399
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
400
- name: errorCode,
401
- $metadata: deserializeMetadata(output),
402
- };
403
- break;
390
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
404
391
  case "ThrottlingException":
405
392
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
406
- response = {
407
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
408
- name: errorCode,
409
- $metadata: deserializeMetadata(output),
410
- };
411
- break;
393
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
412
394
  default:
413
395
  const parsedBody = parsedOutput.body;
414
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
415
- response = {
416
- ...parsedBody,
417
- name: `${errorCode}`,
418
- message: parsedBody.message || parsedBody.Message || errorCode,
396
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
397
+ name: parsedBody.code || parsedBody.Code || errorCode,
419
398
  $fault: "client",
420
399
  $metadata: deserializeMetadata(output),
421
- };
400
+ });
401
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
422
402
  }
423
- const message = response.message || response.Message || errorCode;
424
- response.message = message;
425
- delete response.Message;
426
- return Promise.reject(Object.assign(new Error(message), response));
427
403
  };
428
404
  const deserializeAws_json1_1CreateFlowTemplateCommand = async (output, context) => {
429
405
  if (output.statusCode >= 300) {
@@ -450,59 +426,28 @@ const deserializeAws_json1_1CreateFlowTemplateCommandError = async (output, cont
450
426
  switch (errorCode) {
451
427
  case "InternalFailureException":
452
428
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
453
- response = {
454
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
455
- name: errorCode,
456
- $metadata: deserializeMetadata(output),
457
- };
458
- break;
429
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
459
430
  case "InvalidRequestException":
460
431
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
461
- response = {
462
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
463
- name: errorCode,
464
- $metadata: deserializeMetadata(output),
465
- };
466
- break;
432
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
467
433
  case "LimitExceededException":
468
434
  case "com.amazonaws.iotthingsgraph#LimitExceededException":
469
- response = {
470
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
471
- name: errorCode,
472
- $metadata: deserializeMetadata(output),
473
- };
474
- break;
435
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
475
436
  case "ResourceAlreadyExistsException":
476
437
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
477
- response = {
478
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
479
- name: errorCode,
480
- $metadata: deserializeMetadata(output),
481
- };
482
- break;
438
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
483
439
  case "ThrottlingException":
484
440
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
485
- response = {
486
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
487
- name: errorCode,
488
- $metadata: deserializeMetadata(output),
489
- };
490
- break;
441
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
491
442
  default:
492
443
  const parsedBody = parsedOutput.body;
493
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
494
- response = {
495
- ...parsedBody,
496
- name: `${errorCode}`,
497
- message: parsedBody.message || parsedBody.Message || errorCode,
444
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
445
+ name: parsedBody.code || parsedBody.Code || errorCode,
498
446
  $fault: "client",
499
447
  $metadata: deserializeMetadata(output),
500
- };
448
+ });
449
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
501
450
  }
502
- const message = response.message || response.Message || errorCode;
503
- response.message = message;
504
- delete response.Message;
505
- return Promise.reject(Object.assign(new Error(message), response));
506
451
  };
507
452
  const deserializeAws_json1_1CreateSystemInstanceCommand = async (output, context) => {
508
453
  if (output.statusCode >= 300) {
@@ -529,59 +474,28 @@ const deserializeAws_json1_1CreateSystemInstanceCommandError = async (output, co
529
474
  switch (errorCode) {
530
475
  case "InternalFailureException":
531
476
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
532
- response = {
533
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
534
- name: errorCode,
535
- $metadata: deserializeMetadata(output),
536
- };
537
- break;
477
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
538
478
  case "InvalidRequestException":
539
479
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
540
- response = {
541
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
542
- name: errorCode,
543
- $metadata: deserializeMetadata(output),
544
- };
545
- break;
480
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
546
481
  case "LimitExceededException":
547
482
  case "com.amazonaws.iotthingsgraph#LimitExceededException":
548
- response = {
549
- ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),
550
- name: errorCode,
551
- $metadata: deserializeMetadata(output),
552
- };
553
- break;
483
+ throw await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context);
554
484
  case "ResourceAlreadyExistsException":
555
485
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
556
- response = {
557
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
558
- name: errorCode,
559
- $metadata: deserializeMetadata(output),
560
- };
561
- break;
486
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
562
487
  case "ThrottlingException":
563
488
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
564
- response = {
565
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
566
- name: errorCode,
567
- $metadata: deserializeMetadata(output),
568
- };
569
- break;
489
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
570
490
  default:
571
491
  const parsedBody = parsedOutput.body;
572
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
573
- response = {
574
- ...parsedBody,
575
- name: `${errorCode}`,
576
- message: parsedBody.message || parsedBody.Message || errorCode,
492
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
493
+ name: parsedBody.code || parsedBody.Code || errorCode,
577
494
  $fault: "client",
578
495
  $metadata: deserializeMetadata(output),
579
- };
496
+ });
497
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
580
498
  }
581
- const message = response.message || response.Message || errorCode;
582
- response.message = message;
583
- delete response.Message;
584
- return Promise.reject(Object.assign(new Error(message), response));
585
499
  };
586
500
  const deserializeAws_json1_1CreateSystemTemplateCommand = async (output, context) => {
587
501
  if (output.statusCode >= 300) {
@@ -608,51 +522,25 @@ const deserializeAws_json1_1CreateSystemTemplateCommandError = async (output, co
608
522
  switch (errorCode) {
609
523
  case "InternalFailureException":
610
524
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
611
- response = {
612
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
613
- name: errorCode,
614
- $metadata: deserializeMetadata(output),
615
- };
616
- break;
525
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
617
526
  case "InvalidRequestException":
618
527
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
619
- response = {
620
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
621
- name: errorCode,
622
- $metadata: deserializeMetadata(output),
623
- };
624
- break;
528
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
625
529
  case "ResourceAlreadyExistsException":
626
530
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
627
- response = {
628
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
629
- name: errorCode,
630
- $metadata: deserializeMetadata(output),
631
- };
632
- break;
531
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
633
532
  case "ThrottlingException":
634
533
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
635
- response = {
636
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
637
- name: errorCode,
638
- $metadata: deserializeMetadata(output),
639
- };
640
- break;
534
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
641
535
  default:
642
536
  const parsedBody = parsedOutput.body;
643
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
644
- response = {
645
- ...parsedBody,
646
- name: `${errorCode}`,
647
- message: parsedBody.message || parsedBody.Message || errorCode,
537
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
538
+ name: parsedBody.code || parsedBody.Code || errorCode,
648
539
  $fault: "client",
649
540
  $metadata: deserializeMetadata(output),
650
- };
541
+ });
542
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
651
543
  }
652
- const message = response.message || response.Message || errorCode;
653
- response.message = message;
654
- delete response.Message;
655
- return Promise.reject(Object.assign(new Error(message), response));
656
544
  };
657
545
  const deserializeAws_json1_1DeleteFlowTemplateCommand = async (output, context) => {
658
546
  if (output.statusCode >= 300) {
@@ -679,51 +567,25 @@ const deserializeAws_json1_1DeleteFlowTemplateCommandError = async (output, cont
679
567
  switch (errorCode) {
680
568
  case "InternalFailureException":
681
569
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
682
- response = {
683
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
684
- name: errorCode,
685
- $metadata: deserializeMetadata(output),
686
- };
687
- break;
570
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
688
571
  case "InvalidRequestException":
689
572
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
690
- response = {
691
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
692
- name: errorCode,
693
- $metadata: deserializeMetadata(output),
694
- };
695
- break;
573
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
696
574
  case "ResourceInUseException":
697
575
  case "com.amazonaws.iotthingsgraph#ResourceInUseException":
698
- response = {
699
- ...(await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)),
700
- name: errorCode,
701
- $metadata: deserializeMetadata(output),
702
- };
703
- break;
576
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
704
577
  case "ThrottlingException":
705
578
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
706
- response = {
707
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
708
- name: errorCode,
709
- $metadata: deserializeMetadata(output),
710
- };
711
- break;
579
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
712
580
  default:
713
581
  const parsedBody = parsedOutput.body;
714
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
715
- response = {
716
- ...parsedBody,
717
- name: `${errorCode}`,
718
- message: parsedBody.message || parsedBody.Message || errorCode,
582
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
583
+ name: parsedBody.code || parsedBody.Code || errorCode,
719
584
  $fault: "client",
720
585
  $metadata: deserializeMetadata(output),
721
- };
586
+ });
587
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
722
588
  }
723
- const message = response.message || response.Message || errorCode;
724
- response.message = message;
725
- delete response.Message;
726
- return Promise.reject(Object.assign(new Error(message), response));
727
589
  };
728
590
  const deserializeAws_json1_1DeleteNamespaceCommand = async (output, context) => {
729
591
  if (output.statusCode >= 300) {
@@ -750,35 +612,19 @@ const deserializeAws_json1_1DeleteNamespaceCommandError = async (output, context
750
612
  switch (errorCode) {
751
613
  case "InternalFailureException":
752
614
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
753
- response = {
754
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
755
- name: errorCode,
756
- $metadata: deserializeMetadata(output),
757
- };
758
- break;
615
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
759
616
  case "ThrottlingException":
760
617
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
761
- response = {
762
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
763
- name: errorCode,
764
- $metadata: deserializeMetadata(output),
765
- };
766
- break;
618
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
767
619
  default:
768
620
  const parsedBody = parsedOutput.body;
769
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
770
- response = {
771
- ...parsedBody,
772
- name: `${errorCode}`,
773
- message: parsedBody.message || parsedBody.Message || errorCode,
621
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
622
+ name: parsedBody.code || parsedBody.Code || errorCode,
774
623
  $fault: "client",
775
624
  $metadata: deserializeMetadata(output),
776
- };
625
+ });
626
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
777
627
  }
778
- const message = response.message || response.Message || errorCode;
779
- response.message = message;
780
- delete response.Message;
781
- return Promise.reject(Object.assign(new Error(message), response));
782
628
  };
783
629
  const deserializeAws_json1_1DeleteSystemInstanceCommand = async (output, context) => {
784
630
  if (output.statusCode >= 300) {
@@ -805,51 +651,25 @@ const deserializeAws_json1_1DeleteSystemInstanceCommandError = async (output, co
805
651
  switch (errorCode) {
806
652
  case "InternalFailureException":
807
653
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
808
- response = {
809
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
810
- name: errorCode,
811
- $metadata: deserializeMetadata(output),
812
- };
813
- break;
654
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
814
655
  case "InvalidRequestException":
815
656
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
816
- response = {
817
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
818
- name: errorCode,
819
- $metadata: deserializeMetadata(output),
820
- };
821
- break;
657
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
822
658
  case "ResourceInUseException":
823
659
  case "com.amazonaws.iotthingsgraph#ResourceInUseException":
824
- response = {
825
- ...(await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)),
826
- name: errorCode,
827
- $metadata: deserializeMetadata(output),
828
- };
829
- break;
660
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
830
661
  case "ThrottlingException":
831
662
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
832
- response = {
833
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
834
- name: errorCode,
835
- $metadata: deserializeMetadata(output),
836
- };
837
- break;
663
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
838
664
  default:
839
665
  const parsedBody = parsedOutput.body;
840
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
841
- response = {
842
- ...parsedBody,
843
- name: `${errorCode}`,
844
- message: parsedBody.message || parsedBody.Message || errorCode,
666
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
667
+ name: parsedBody.code || parsedBody.Code || errorCode,
845
668
  $fault: "client",
846
669
  $metadata: deserializeMetadata(output),
847
- };
670
+ });
671
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
848
672
  }
849
- const message = response.message || response.Message || errorCode;
850
- response.message = message;
851
- delete response.Message;
852
- return Promise.reject(Object.assign(new Error(message), response));
853
673
  };
854
674
  const deserializeAws_json1_1DeleteSystemTemplateCommand = async (output, context) => {
855
675
  if (output.statusCode >= 300) {
@@ -876,51 +696,25 @@ const deserializeAws_json1_1DeleteSystemTemplateCommandError = async (output, co
876
696
  switch (errorCode) {
877
697
  case "InternalFailureException":
878
698
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
879
- response = {
880
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
881
- name: errorCode,
882
- $metadata: deserializeMetadata(output),
883
- };
884
- break;
699
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
885
700
  case "InvalidRequestException":
886
701
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
887
- response = {
888
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
889
- name: errorCode,
890
- $metadata: deserializeMetadata(output),
891
- };
892
- break;
702
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
893
703
  case "ResourceInUseException":
894
704
  case "com.amazonaws.iotthingsgraph#ResourceInUseException":
895
- response = {
896
- ...(await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)),
897
- name: errorCode,
898
- $metadata: deserializeMetadata(output),
899
- };
900
- break;
705
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
901
706
  case "ThrottlingException":
902
707
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
903
- response = {
904
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
905
- name: errorCode,
906
- $metadata: deserializeMetadata(output),
907
- };
908
- break;
708
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
909
709
  default:
910
710
  const parsedBody = parsedOutput.body;
911
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
912
- response = {
913
- ...parsedBody,
914
- name: `${errorCode}`,
915
- message: parsedBody.message || parsedBody.Message || errorCode,
711
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
712
+ name: parsedBody.code || parsedBody.Code || errorCode,
916
713
  $fault: "client",
917
714
  $metadata: deserializeMetadata(output),
918
- };
715
+ });
716
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
919
717
  }
920
- const message = response.message || response.Message || errorCode;
921
- response.message = message;
922
- delete response.Message;
923
- return Promise.reject(Object.assign(new Error(message), response));
924
718
  };
925
719
  const deserializeAws_json1_1DeploySystemInstanceCommand = async (output, context) => {
926
720
  if (output.statusCode >= 300) {
@@ -947,59 +741,28 @@ const deserializeAws_json1_1DeploySystemInstanceCommandError = async (output, co
947
741
  switch (errorCode) {
948
742
  case "InternalFailureException":
949
743
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
950
- response = {
951
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
952
- name: errorCode,
953
- $metadata: deserializeMetadata(output),
954
- };
955
- break;
744
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
956
745
  case "InvalidRequestException":
957
746
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
958
- response = {
959
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
960
- name: errorCode,
961
- $metadata: deserializeMetadata(output),
962
- };
963
- break;
747
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
964
748
  case "ResourceInUseException":
965
749
  case "com.amazonaws.iotthingsgraph#ResourceInUseException":
966
- response = {
967
- ...(await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)),
968
- name: errorCode,
969
- $metadata: deserializeMetadata(output),
970
- };
971
- break;
750
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
972
751
  case "ResourceNotFoundException":
973
752
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
974
- response = {
975
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
976
- name: errorCode,
977
- $metadata: deserializeMetadata(output),
978
- };
979
- break;
753
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
980
754
  case "ThrottlingException":
981
755
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
982
- response = {
983
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
984
- name: errorCode,
985
- $metadata: deserializeMetadata(output),
986
- };
987
- break;
756
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
988
757
  default:
989
758
  const parsedBody = parsedOutput.body;
990
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
991
- response = {
992
- ...parsedBody,
993
- name: `${errorCode}`,
994
- message: parsedBody.message || parsedBody.Message || errorCode,
759
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
760
+ name: parsedBody.code || parsedBody.Code || errorCode,
995
761
  $fault: "client",
996
762
  $metadata: deserializeMetadata(output),
997
- };
763
+ });
764
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
998
765
  }
999
- const message = response.message || response.Message || errorCode;
1000
- response.message = message;
1001
- delete response.Message;
1002
- return Promise.reject(Object.assign(new Error(message), response));
1003
766
  };
1004
767
  const deserializeAws_json1_1DeprecateFlowTemplateCommand = async (output, context) => {
1005
768
  if (output.statusCode >= 300) {
@@ -1026,51 +789,25 @@ const deserializeAws_json1_1DeprecateFlowTemplateCommandError = async (output, c
1026
789
  switch (errorCode) {
1027
790
  case "InternalFailureException":
1028
791
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1029
- response = {
1030
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1031
- name: errorCode,
1032
- $metadata: deserializeMetadata(output),
1033
- };
1034
- break;
792
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1035
793
  case "InvalidRequestException":
1036
794
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1037
- response = {
1038
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1039
- name: errorCode,
1040
- $metadata: deserializeMetadata(output),
1041
- };
1042
- break;
795
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1043
796
  case "ResourceNotFoundException":
1044
797
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1045
- response = {
1046
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1047
- name: errorCode,
1048
- $metadata: deserializeMetadata(output),
1049
- };
1050
- break;
798
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1051
799
  case "ThrottlingException":
1052
800
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1053
- response = {
1054
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1055
- name: errorCode,
1056
- $metadata: deserializeMetadata(output),
1057
- };
1058
- break;
801
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1059
802
  default:
1060
803
  const parsedBody = parsedOutput.body;
1061
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1062
- response = {
1063
- ...parsedBody,
1064
- name: `${errorCode}`,
1065
- message: parsedBody.message || parsedBody.Message || errorCode,
804
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
805
+ name: parsedBody.code || parsedBody.Code || errorCode,
1066
806
  $fault: "client",
1067
807
  $metadata: deserializeMetadata(output),
1068
- };
808
+ });
809
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1069
810
  }
1070
- const message = response.message || response.Message || errorCode;
1071
- response.message = message;
1072
- delete response.Message;
1073
- return Promise.reject(Object.assign(new Error(message), response));
1074
811
  };
1075
812
  const deserializeAws_json1_1DeprecateSystemTemplateCommand = async (output, context) => {
1076
813
  if (output.statusCode >= 300) {
@@ -1097,51 +834,25 @@ const deserializeAws_json1_1DeprecateSystemTemplateCommandError = async (output,
1097
834
  switch (errorCode) {
1098
835
  case "InternalFailureException":
1099
836
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1100
- response = {
1101
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1102
- name: errorCode,
1103
- $metadata: deserializeMetadata(output),
1104
- };
1105
- break;
837
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1106
838
  case "InvalidRequestException":
1107
839
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1108
- response = {
1109
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1110
- name: errorCode,
1111
- $metadata: deserializeMetadata(output),
1112
- };
1113
- break;
840
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1114
841
  case "ResourceNotFoundException":
1115
842
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1116
- response = {
1117
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1118
- name: errorCode,
1119
- $metadata: deserializeMetadata(output),
1120
- };
1121
- break;
843
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1122
844
  case "ThrottlingException":
1123
845
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1124
- response = {
1125
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1126
- name: errorCode,
1127
- $metadata: deserializeMetadata(output),
1128
- };
1129
- break;
846
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1130
847
  default:
1131
848
  const parsedBody = parsedOutput.body;
1132
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1133
- response = {
1134
- ...parsedBody,
1135
- name: `${errorCode}`,
1136
- message: parsedBody.message || parsedBody.Message || errorCode,
849
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
850
+ name: parsedBody.code || parsedBody.Code || errorCode,
1137
851
  $fault: "client",
1138
852
  $metadata: deserializeMetadata(output),
1139
- };
853
+ });
854
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1140
855
  }
1141
- const message = response.message || response.Message || errorCode;
1142
- response.message = message;
1143
- delete response.Message;
1144
- return Promise.reject(Object.assign(new Error(message), response));
1145
856
  };
1146
857
  const deserializeAws_json1_1DescribeNamespaceCommand = async (output, context) => {
1147
858
  if (output.statusCode >= 300) {
@@ -1168,51 +879,25 @@ const deserializeAws_json1_1DescribeNamespaceCommandError = async (output, conte
1168
879
  switch (errorCode) {
1169
880
  case "InternalFailureException":
1170
881
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1171
- response = {
1172
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1173
- name: errorCode,
1174
- $metadata: deserializeMetadata(output),
1175
- };
1176
- break;
882
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1177
883
  case "InvalidRequestException":
1178
884
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1179
- response = {
1180
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1181
- name: errorCode,
1182
- $metadata: deserializeMetadata(output),
1183
- };
1184
- break;
885
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1185
886
  case "ResourceNotFoundException":
1186
887
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1187
- response = {
1188
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1189
- name: errorCode,
1190
- $metadata: deserializeMetadata(output),
1191
- };
1192
- break;
888
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1193
889
  case "ThrottlingException":
1194
890
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1195
- response = {
1196
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1197
- name: errorCode,
1198
- $metadata: deserializeMetadata(output),
1199
- };
1200
- break;
891
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1201
892
  default:
1202
893
  const parsedBody = parsedOutput.body;
1203
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1204
- response = {
1205
- ...parsedBody,
1206
- name: `${errorCode}`,
1207
- message: parsedBody.message || parsedBody.Message || errorCode,
894
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
895
+ name: parsedBody.code || parsedBody.Code || errorCode,
1208
896
  $fault: "client",
1209
897
  $metadata: deserializeMetadata(output),
1210
- };
898
+ });
899
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1211
900
  }
1212
- const message = response.message || response.Message || errorCode;
1213
- response.message = message;
1214
- delete response.Message;
1215
- return Promise.reject(Object.assign(new Error(message), response));
1216
901
  };
1217
902
  const deserializeAws_json1_1DissociateEntityFromThingCommand = async (output, context) => {
1218
903
  if (output.statusCode >= 300) {
@@ -1239,51 +924,25 @@ const deserializeAws_json1_1DissociateEntityFromThingCommandError = async (outpu
1239
924
  switch (errorCode) {
1240
925
  case "InternalFailureException":
1241
926
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1242
- response = {
1243
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1244
- name: errorCode,
1245
- $metadata: deserializeMetadata(output),
1246
- };
1247
- break;
927
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1248
928
  case "InvalidRequestException":
1249
929
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1250
- response = {
1251
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1252
- name: errorCode,
1253
- $metadata: deserializeMetadata(output),
1254
- };
1255
- break;
930
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1256
931
  case "ResourceNotFoundException":
1257
932
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1258
- response = {
1259
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1260
- name: errorCode,
1261
- $metadata: deserializeMetadata(output),
1262
- };
1263
- break;
933
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1264
934
  case "ThrottlingException":
1265
935
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1266
- response = {
1267
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1268
- name: errorCode,
1269
- $metadata: deserializeMetadata(output),
1270
- };
1271
- break;
936
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1272
937
  default:
1273
938
  const parsedBody = parsedOutput.body;
1274
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1275
- response = {
1276
- ...parsedBody,
1277
- name: `${errorCode}`,
1278
- message: parsedBody.message || parsedBody.Message || errorCode,
939
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
940
+ name: parsedBody.code || parsedBody.Code || errorCode,
1279
941
  $fault: "client",
1280
942
  $metadata: deserializeMetadata(output),
1281
- };
943
+ });
944
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1282
945
  }
1283
- const message = response.message || response.Message || errorCode;
1284
- response.message = message;
1285
- delete response.Message;
1286
- return Promise.reject(Object.assign(new Error(message), response));
1287
946
  };
1288
947
  const deserializeAws_json1_1GetEntitiesCommand = async (output, context) => {
1289
948
  if (output.statusCode >= 300) {
@@ -1310,51 +969,25 @@ const deserializeAws_json1_1GetEntitiesCommandError = async (output, context) =>
1310
969
  switch (errorCode) {
1311
970
  case "InternalFailureException":
1312
971
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1313
- response = {
1314
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1315
- name: errorCode,
1316
- $metadata: deserializeMetadata(output),
1317
- };
1318
- break;
972
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1319
973
  case "InvalidRequestException":
1320
974
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1321
- response = {
1322
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1323
- name: errorCode,
1324
- $metadata: deserializeMetadata(output),
1325
- };
1326
- break;
975
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1327
976
  case "ResourceNotFoundException":
1328
977
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1329
- response = {
1330
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1331
- name: errorCode,
1332
- $metadata: deserializeMetadata(output),
1333
- };
1334
- break;
978
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1335
979
  case "ThrottlingException":
1336
980
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1337
- response = {
1338
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1339
- name: errorCode,
1340
- $metadata: deserializeMetadata(output),
1341
- };
1342
- break;
981
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1343
982
  default:
1344
983
  const parsedBody = parsedOutput.body;
1345
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1346
- response = {
1347
- ...parsedBody,
1348
- name: `${errorCode}`,
1349
- message: parsedBody.message || parsedBody.Message || errorCode,
984
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
985
+ name: parsedBody.code || parsedBody.Code || errorCode,
1350
986
  $fault: "client",
1351
987
  $metadata: deserializeMetadata(output),
1352
- };
988
+ });
989
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1353
990
  }
1354
- const message = response.message || response.Message || errorCode;
1355
- response.message = message;
1356
- delete response.Message;
1357
- return Promise.reject(Object.assign(new Error(message), response));
1358
991
  };
1359
992
  const deserializeAws_json1_1GetFlowTemplateCommand = async (output, context) => {
1360
993
  if (output.statusCode >= 300) {
@@ -1381,51 +1014,25 @@ const deserializeAws_json1_1GetFlowTemplateCommandError = async (output, context
1381
1014
  switch (errorCode) {
1382
1015
  case "InternalFailureException":
1383
1016
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1384
- response = {
1385
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1386
- name: errorCode,
1387
- $metadata: deserializeMetadata(output),
1388
- };
1389
- break;
1017
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1390
1018
  case "InvalidRequestException":
1391
1019
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1392
- response = {
1393
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1394
- name: errorCode,
1395
- $metadata: deserializeMetadata(output),
1396
- };
1397
- break;
1020
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1398
1021
  case "ResourceNotFoundException":
1399
1022
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1400
- response = {
1401
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1402
- name: errorCode,
1403
- $metadata: deserializeMetadata(output),
1404
- };
1405
- break;
1023
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1406
1024
  case "ThrottlingException":
1407
1025
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1408
- response = {
1409
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1410
- name: errorCode,
1411
- $metadata: deserializeMetadata(output),
1412
- };
1413
- break;
1026
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1414
1027
  default:
1415
1028
  const parsedBody = parsedOutput.body;
1416
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1417
- response = {
1418
- ...parsedBody,
1419
- name: `${errorCode}`,
1420
- message: parsedBody.message || parsedBody.Message || errorCode,
1029
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1030
+ name: parsedBody.code || parsedBody.Code || errorCode,
1421
1031
  $fault: "client",
1422
1032
  $metadata: deserializeMetadata(output),
1423
- };
1033
+ });
1034
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1424
1035
  }
1425
- const message = response.message || response.Message || errorCode;
1426
- response.message = message;
1427
- delete response.Message;
1428
- return Promise.reject(Object.assign(new Error(message), response));
1429
1036
  };
1430
1037
  const deserializeAws_json1_1GetFlowTemplateRevisionsCommand = async (output, context) => {
1431
1038
  if (output.statusCode >= 300) {
@@ -1452,51 +1059,25 @@ const deserializeAws_json1_1GetFlowTemplateRevisionsCommandError = async (output
1452
1059
  switch (errorCode) {
1453
1060
  case "InternalFailureException":
1454
1061
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1455
- response = {
1456
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1457
- name: errorCode,
1458
- $metadata: deserializeMetadata(output),
1459
- };
1460
- break;
1062
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1461
1063
  case "InvalidRequestException":
1462
1064
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1463
- response = {
1464
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1465
- name: errorCode,
1466
- $metadata: deserializeMetadata(output),
1467
- };
1468
- break;
1065
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1469
1066
  case "ResourceNotFoundException":
1470
1067
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1471
- response = {
1472
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1473
- name: errorCode,
1474
- $metadata: deserializeMetadata(output),
1475
- };
1476
- break;
1068
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1477
1069
  case "ThrottlingException":
1478
1070
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1479
- response = {
1480
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1481
- name: errorCode,
1482
- $metadata: deserializeMetadata(output),
1483
- };
1484
- break;
1071
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1485
1072
  default:
1486
1073
  const parsedBody = parsedOutput.body;
1487
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1488
- response = {
1489
- ...parsedBody,
1490
- name: `${errorCode}`,
1491
- message: parsedBody.message || parsedBody.Message || errorCode,
1074
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1075
+ name: parsedBody.code || parsedBody.Code || errorCode,
1492
1076
  $fault: "client",
1493
1077
  $metadata: deserializeMetadata(output),
1494
- };
1078
+ });
1079
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1495
1080
  }
1496
- const message = response.message || response.Message || errorCode;
1497
- response.message = message;
1498
- delete response.Message;
1499
- return Promise.reject(Object.assign(new Error(message), response));
1500
1081
  };
1501
1082
  const deserializeAws_json1_1GetNamespaceDeletionStatusCommand = async (output, context) => {
1502
1083
  if (output.statusCode >= 300) {
@@ -1523,43 +1104,22 @@ const deserializeAws_json1_1GetNamespaceDeletionStatusCommandError = async (outp
1523
1104
  switch (errorCode) {
1524
1105
  case "InternalFailureException":
1525
1106
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1526
- response = {
1527
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1528
- name: errorCode,
1529
- $metadata: deserializeMetadata(output),
1530
- };
1531
- break;
1107
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1532
1108
  case "InvalidRequestException":
1533
1109
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1534
- response = {
1535
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1536
- name: errorCode,
1537
- $metadata: deserializeMetadata(output),
1538
- };
1539
- break;
1110
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1540
1111
  case "ThrottlingException":
1541
1112
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1542
- response = {
1543
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1544
- name: errorCode,
1545
- $metadata: deserializeMetadata(output),
1546
- };
1547
- break;
1113
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1548
1114
  default:
1549
1115
  const parsedBody = parsedOutput.body;
1550
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1551
- response = {
1552
- ...parsedBody,
1553
- name: `${errorCode}`,
1554
- message: parsedBody.message || parsedBody.Message || errorCode,
1116
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1117
+ name: parsedBody.code || parsedBody.Code || errorCode,
1555
1118
  $fault: "client",
1556
1119
  $metadata: deserializeMetadata(output),
1557
- };
1120
+ });
1121
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1558
1122
  }
1559
- const message = response.message || response.Message || errorCode;
1560
- response.message = message;
1561
- delete response.Message;
1562
- return Promise.reject(Object.assign(new Error(message), response));
1563
1123
  };
1564
1124
  const deserializeAws_json1_1GetSystemInstanceCommand = async (output, context) => {
1565
1125
  if (output.statusCode >= 300) {
@@ -1586,51 +1146,25 @@ const deserializeAws_json1_1GetSystemInstanceCommandError = async (output, conte
1586
1146
  switch (errorCode) {
1587
1147
  case "InternalFailureException":
1588
1148
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1589
- response = {
1590
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1591
- name: errorCode,
1592
- $metadata: deserializeMetadata(output),
1593
- };
1594
- break;
1149
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1595
1150
  case "InvalidRequestException":
1596
1151
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1597
- response = {
1598
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1599
- name: errorCode,
1600
- $metadata: deserializeMetadata(output),
1601
- };
1602
- break;
1152
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1603
1153
  case "ResourceNotFoundException":
1604
1154
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1605
- response = {
1606
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1607
- name: errorCode,
1608
- $metadata: deserializeMetadata(output),
1609
- };
1610
- break;
1155
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1611
1156
  case "ThrottlingException":
1612
1157
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1613
- response = {
1614
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1615
- name: errorCode,
1616
- $metadata: deserializeMetadata(output),
1617
- };
1618
- break;
1158
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1619
1159
  default:
1620
1160
  const parsedBody = parsedOutput.body;
1621
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1622
- response = {
1623
- ...parsedBody,
1624
- name: `${errorCode}`,
1625
- message: parsedBody.message || parsedBody.Message || errorCode,
1161
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1162
+ name: parsedBody.code || parsedBody.Code || errorCode,
1626
1163
  $fault: "client",
1627
1164
  $metadata: deserializeMetadata(output),
1628
- };
1165
+ });
1166
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1629
1167
  }
1630
- const message = response.message || response.Message || errorCode;
1631
- response.message = message;
1632
- delete response.Message;
1633
- return Promise.reject(Object.assign(new Error(message), response));
1634
1168
  };
1635
1169
  const deserializeAws_json1_1GetSystemTemplateCommand = async (output, context) => {
1636
1170
  if (output.statusCode >= 300) {
@@ -1657,51 +1191,25 @@ const deserializeAws_json1_1GetSystemTemplateCommandError = async (output, conte
1657
1191
  switch (errorCode) {
1658
1192
  case "InternalFailureException":
1659
1193
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1660
- response = {
1661
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1662
- name: errorCode,
1663
- $metadata: deserializeMetadata(output),
1664
- };
1665
- break;
1194
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1666
1195
  case "InvalidRequestException":
1667
1196
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1668
- response = {
1669
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1670
- name: errorCode,
1671
- $metadata: deserializeMetadata(output),
1672
- };
1673
- break;
1197
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1674
1198
  case "ResourceNotFoundException":
1675
1199
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1676
- response = {
1677
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1678
- name: errorCode,
1679
- $metadata: deserializeMetadata(output),
1680
- };
1681
- break;
1200
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1682
1201
  case "ThrottlingException":
1683
1202
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1684
- response = {
1685
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1686
- name: errorCode,
1687
- $metadata: deserializeMetadata(output),
1688
- };
1689
- break;
1203
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1690
1204
  default:
1691
1205
  const parsedBody = parsedOutput.body;
1692
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1693
- response = {
1694
- ...parsedBody,
1695
- name: `${errorCode}`,
1696
- message: parsedBody.message || parsedBody.Message || errorCode,
1206
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1207
+ name: parsedBody.code || parsedBody.Code || errorCode,
1697
1208
  $fault: "client",
1698
1209
  $metadata: deserializeMetadata(output),
1699
- };
1210
+ });
1211
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1700
1212
  }
1701
- const message = response.message || response.Message || errorCode;
1702
- response.message = message;
1703
- delete response.Message;
1704
- return Promise.reject(Object.assign(new Error(message), response));
1705
1213
  };
1706
1214
  const deserializeAws_json1_1GetSystemTemplateRevisionsCommand = async (output, context) => {
1707
1215
  if (output.statusCode >= 300) {
@@ -1728,51 +1236,25 @@ const deserializeAws_json1_1GetSystemTemplateRevisionsCommandError = async (outp
1728
1236
  switch (errorCode) {
1729
1237
  case "InternalFailureException":
1730
1238
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1731
- response = {
1732
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1733
- name: errorCode,
1734
- $metadata: deserializeMetadata(output),
1735
- };
1736
- break;
1239
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1737
1240
  case "InvalidRequestException":
1738
1241
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1739
- response = {
1740
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1741
- name: errorCode,
1742
- $metadata: deserializeMetadata(output),
1743
- };
1744
- break;
1242
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1745
1243
  case "ResourceNotFoundException":
1746
1244
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1747
- response = {
1748
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1749
- name: errorCode,
1750
- $metadata: deserializeMetadata(output),
1751
- };
1752
- break;
1245
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1753
1246
  case "ThrottlingException":
1754
1247
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1755
- response = {
1756
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1757
- name: errorCode,
1758
- $metadata: deserializeMetadata(output),
1759
- };
1760
- break;
1248
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1761
1249
  default:
1762
1250
  const parsedBody = parsedOutput.body;
1763
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1764
- response = {
1765
- ...parsedBody,
1766
- name: `${errorCode}`,
1767
- message: parsedBody.message || parsedBody.Message || errorCode,
1251
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1252
+ name: parsedBody.code || parsedBody.Code || errorCode,
1768
1253
  $fault: "client",
1769
1254
  $metadata: deserializeMetadata(output),
1770
- };
1255
+ });
1256
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1771
1257
  }
1772
- const message = response.message || response.Message || errorCode;
1773
- response.message = message;
1774
- delete response.Message;
1775
- return Promise.reject(Object.assign(new Error(message), response));
1776
1258
  };
1777
1259
  const deserializeAws_json1_1GetUploadStatusCommand = async (output, context) => {
1778
1260
  if (output.statusCode >= 300) {
@@ -1799,51 +1281,25 @@ const deserializeAws_json1_1GetUploadStatusCommandError = async (output, context
1799
1281
  switch (errorCode) {
1800
1282
  case "InternalFailureException":
1801
1283
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1802
- response = {
1803
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1804
- name: errorCode,
1805
- $metadata: deserializeMetadata(output),
1806
- };
1807
- break;
1284
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1808
1285
  case "InvalidRequestException":
1809
1286
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1810
- response = {
1811
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1812
- name: errorCode,
1813
- $metadata: deserializeMetadata(output),
1814
- };
1815
- break;
1287
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1816
1288
  case "ResourceNotFoundException":
1817
1289
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1818
- response = {
1819
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1820
- name: errorCode,
1821
- $metadata: deserializeMetadata(output),
1822
- };
1823
- break;
1290
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1824
1291
  case "ThrottlingException":
1825
1292
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1826
- response = {
1827
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1828
- name: errorCode,
1829
- $metadata: deserializeMetadata(output),
1830
- };
1831
- break;
1293
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1832
1294
  default:
1833
1295
  const parsedBody = parsedOutput.body;
1834
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1835
- response = {
1836
- ...parsedBody,
1837
- name: `${errorCode}`,
1838
- message: parsedBody.message || parsedBody.Message || errorCode,
1296
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1297
+ name: parsedBody.code || parsedBody.Code || errorCode,
1839
1298
  $fault: "client",
1840
1299
  $metadata: deserializeMetadata(output),
1841
- };
1300
+ });
1301
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1842
1302
  }
1843
- const message = response.message || response.Message || errorCode;
1844
- response.message = message;
1845
- delete response.Message;
1846
- return Promise.reject(Object.assign(new Error(message), response));
1847
1303
  };
1848
1304
  const deserializeAws_json1_1ListFlowExecutionMessagesCommand = async (output, context) => {
1849
1305
  if (output.statusCode >= 300) {
@@ -1870,51 +1326,25 @@ const deserializeAws_json1_1ListFlowExecutionMessagesCommandError = async (outpu
1870
1326
  switch (errorCode) {
1871
1327
  case "InternalFailureException":
1872
1328
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1873
- response = {
1874
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1875
- name: errorCode,
1876
- $metadata: deserializeMetadata(output),
1877
- };
1878
- break;
1329
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1879
1330
  case "InvalidRequestException":
1880
1331
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1881
- response = {
1882
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1883
- name: errorCode,
1884
- $metadata: deserializeMetadata(output),
1885
- };
1886
- break;
1332
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1887
1333
  case "ResourceNotFoundException":
1888
1334
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
1889
- response = {
1890
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1891
- name: errorCode,
1892
- $metadata: deserializeMetadata(output),
1893
- };
1894
- break;
1335
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
1895
1336
  case "ThrottlingException":
1896
1337
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1897
- response = {
1898
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1899
- name: errorCode,
1900
- $metadata: deserializeMetadata(output),
1901
- };
1902
- break;
1338
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1903
1339
  default:
1904
1340
  const parsedBody = parsedOutput.body;
1905
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1906
- response = {
1907
- ...parsedBody,
1908
- name: `${errorCode}`,
1909
- message: parsedBody.message || parsedBody.Message || errorCode,
1341
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1342
+ name: parsedBody.code || parsedBody.Code || errorCode,
1910
1343
  $fault: "client",
1911
1344
  $metadata: deserializeMetadata(output),
1912
- };
1345
+ });
1346
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1913
1347
  }
1914
- const message = response.message || response.Message || errorCode;
1915
- response.message = message;
1916
- delete response.Message;
1917
- return Promise.reject(Object.assign(new Error(message), response));
1918
1348
  };
1919
1349
  const deserializeAws_json1_1ListTagsForResourceCommand = async (output, context) => {
1920
1350
  if (output.statusCode >= 300) {
@@ -1941,51 +1371,25 @@ const deserializeAws_json1_1ListTagsForResourceCommandError = async (output, con
1941
1371
  switch (errorCode) {
1942
1372
  case "InternalFailureException":
1943
1373
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
1944
- response = {
1945
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
1946
- name: errorCode,
1947
- $metadata: deserializeMetadata(output),
1948
- };
1949
- break;
1374
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
1950
1375
  case "InvalidRequestException":
1951
1376
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
1952
- response = {
1953
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
1954
- name: errorCode,
1955
- $metadata: deserializeMetadata(output),
1956
- };
1957
- break;
1377
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
1958
1378
  case "ResourceAlreadyExistsException":
1959
1379
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
1960
- response = {
1961
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
1962
- name: errorCode,
1963
- $metadata: deserializeMetadata(output),
1964
- };
1965
- break;
1380
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
1966
1381
  case "ThrottlingException":
1967
1382
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
1968
- response = {
1969
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
1970
- name: errorCode,
1971
- $metadata: deserializeMetadata(output),
1972
- };
1973
- break;
1383
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
1974
1384
  default:
1975
1385
  const parsedBody = parsedOutput.body;
1976
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1977
- response = {
1978
- ...parsedBody,
1979
- name: `${errorCode}`,
1980
- message: parsedBody.message || parsedBody.Message || errorCode,
1386
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1387
+ name: parsedBody.code || parsedBody.Code || errorCode,
1981
1388
  $fault: "client",
1982
1389
  $metadata: deserializeMetadata(output),
1983
- };
1390
+ });
1391
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1984
1392
  }
1985
- const message = response.message || response.Message || errorCode;
1986
- response.message = message;
1987
- delete response.Message;
1988
- return Promise.reject(Object.assign(new Error(message), response));
1989
1393
  };
1990
1394
  const deserializeAws_json1_1SearchEntitiesCommand = async (output, context) => {
1991
1395
  if (output.statusCode >= 300) {
@@ -2012,43 +1416,22 @@ const deserializeAws_json1_1SearchEntitiesCommandError = async (output, context)
2012
1416
  switch (errorCode) {
2013
1417
  case "InternalFailureException":
2014
1418
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2015
- response = {
2016
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2017
- name: errorCode,
2018
- $metadata: deserializeMetadata(output),
2019
- };
2020
- break;
1419
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2021
1420
  case "InvalidRequestException":
2022
1421
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2023
- response = {
2024
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2025
- name: errorCode,
2026
- $metadata: deserializeMetadata(output),
2027
- };
2028
- break;
1422
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2029
1423
  case "ThrottlingException":
2030
1424
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2031
- response = {
2032
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2033
- name: errorCode,
2034
- $metadata: deserializeMetadata(output),
2035
- };
2036
- break;
1425
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2037
1426
  default:
2038
1427
  const parsedBody = parsedOutput.body;
2039
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2040
- response = {
2041
- ...parsedBody,
2042
- name: `${errorCode}`,
2043
- message: parsedBody.message || parsedBody.Message || errorCode,
1428
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1429
+ name: parsedBody.code || parsedBody.Code || errorCode,
2044
1430
  $fault: "client",
2045
1431
  $metadata: deserializeMetadata(output),
2046
- };
1432
+ });
1433
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2047
1434
  }
2048
- const message = response.message || response.Message || errorCode;
2049
- response.message = message;
2050
- delete response.Message;
2051
- return Promise.reject(Object.assign(new Error(message), response));
2052
1435
  };
2053
1436
  const deserializeAws_json1_1SearchFlowExecutionsCommand = async (output, context) => {
2054
1437
  if (output.statusCode >= 300) {
@@ -2075,51 +1458,25 @@ const deserializeAws_json1_1SearchFlowExecutionsCommandError = async (output, co
2075
1458
  switch (errorCode) {
2076
1459
  case "InternalFailureException":
2077
1460
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2078
- response = {
2079
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2080
- name: errorCode,
2081
- $metadata: deserializeMetadata(output),
2082
- };
2083
- break;
1461
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2084
1462
  case "InvalidRequestException":
2085
1463
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2086
- response = {
2087
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2088
- name: errorCode,
2089
- $metadata: deserializeMetadata(output),
2090
- };
2091
- break;
1464
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2092
1465
  case "ResourceNotFoundException":
2093
1466
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
2094
- response = {
2095
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2096
- name: errorCode,
2097
- $metadata: deserializeMetadata(output),
2098
- };
2099
- break;
1467
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2100
1468
  case "ThrottlingException":
2101
1469
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2102
- response = {
2103
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2104
- name: errorCode,
2105
- $metadata: deserializeMetadata(output),
2106
- };
2107
- break;
1470
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2108
1471
  default:
2109
1472
  const parsedBody = parsedOutput.body;
2110
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2111
- response = {
2112
- ...parsedBody,
2113
- name: `${errorCode}`,
2114
- message: parsedBody.message || parsedBody.Message || errorCode,
1473
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1474
+ name: parsedBody.code || parsedBody.Code || errorCode,
2115
1475
  $fault: "client",
2116
1476
  $metadata: deserializeMetadata(output),
2117
- };
1477
+ });
1478
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2118
1479
  }
2119
- const message = response.message || response.Message || errorCode;
2120
- response.message = message;
2121
- delete response.Message;
2122
- return Promise.reject(Object.assign(new Error(message), response));
2123
1480
  };
2124
1481
  const deserializeAws_json1_1SearchFlowTemplatesCommand = async (output, context) => {
2125
1482
  if (output.statusCode >= 300) {
@@ -2146,43 +1503,22 @@ const deserializeAws_json1_1SearchFlowTemplatesCommandError = async (output, con
2146
1503
  switch (errorCode) {
2147
1504
  case "InternalFailureException":
2148
1505
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2149
- response = {
2150
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2151
- name: errorCode,
2152
- $metadata: deserializeMetadata(output),
2153
- };
2154
- break;
1506
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2155
1507
  case "InvalidRequestException":
2156
1508
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2157
- response = {
2158
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2159
- name: errorCode,
2160
- $metadata: deserializeMetadata(output),
2161
- };
2162
- break;
1509
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2163
1510
  case "ThrottlingException":
2164
1511
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2165
- response = {
2166
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2167
- name: errorCode,
2168
- $metadata: deserializeMetadata(output),
2169
- };
2170
- break;
1512
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2171
1513
  default:
2172
1514
  const parsedBody = parsedOutput.body;
2173
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2174
- response = {
2175
- ...parsedBody,
2176
- name: `${errorCode}`,
2177
- message: parsedBody.message || parsedBody.Message || errorCode,
1515
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1516
+ name: parsedBody.code || parsedBody.Code || errorCode,
2178
1517
  $fault: "client",
2179
1518
  $metadata: deserializeMetadata(output),
2180
- };
1519
+ });
1520
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2181
1521
  }
2182
- const message = response.message || response.Message || errorCode;
2183
- response.message = message;
2184
- delete response.Message;
2185
- return Promise.reject(Object.assign(new Error(message), response));
2186
1522
  };
2187
1523
  const deserializeAws_json1_1SearchSystemInstancesCommand = async (output, context) => {
2188
1524
  if (output.statusCode >= 300) {
@@ -2209,43 +1545,22 @@ const deserializeAws_json1_1SearchSystemInstancesCommandError = async (output, c
2209
1545
  switch (errorCode) {
2210
1546
  case "InternalFailureException":
2211
1547
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2212
- response = {
2213
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2214
- name: errorCode,
2215
- $metadata: deserializeMetadata(output),
2216
- };
2217
- break;
1548
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2218
1549
  case "InvalidRequestException":
2219
1550
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2220
- response = {
2221
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2222
- name: errorCode,
2223
- $metadata: deserializeMetadata(output),
2224
- };
2225
- break;
1551
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2226
1552
  case "ThrottlingException":
2227
1553
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2228
- response = {
2229
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2230
- name: errorCode,
2231
- $metadata: deserializeMetadata(output),
2232
- };
2233
- break;
1554
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2234
1555
  default:
2235
1556
  const parsedBody = parsedOutput.body;
2236
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2237
- response = {
2238
- ...parsedBody,
2239
- name: `${errorCode}`,
2240
- message: parsedBody.message || parsedBody.Message || errorCode,
1557
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1558
+ name: parsedBody.code || parsedBody.Code || errorCode,
2241
1559
  $fault: "client",
2242
1560
  $metadata: deserializeMetadata(output),
2243
- };
1561
+ });
1562
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2244
1563
  }
2245
- const message = response.message || response.Message || errorCode;
2246
- response.message = message;
2247
- delete response.Message;
2248
- return Promise.reject(Object.assign(new Error(message), response));
2249
1564
  };
2250
1565
  const deserializeAws_json1_1SearchSystemTemplatesCommand = async (output, context) => {
2251
1566
  if (output.statusCode >= 300) {
@@ -2272,43 +1587,22 @@ const deserializeAws_json1_1SearchSystemTemplatesCommandError = async (output, c
2272
1587
  switch (errorCode) {
2273
1588
  case "InternalFailureException":
2274
1589
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2275
- response = {
2276
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2277
- name: errorCode,
2278
- $metadata: deserializeMetadata(output),
2279
- };
2280
- break;
1590
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2281
1591
  case "InvalidRequestException":
2282
1592
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2283
- response = {
2284
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2285
- name: errorCode,
2286
- $metadata: deserializeMetadata(output),
2287
- };
2288
- break;
1593
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2289
1594
  case "ThrottlingException":
2290
1595
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2291
- response = {
2292
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2293
- name: errorCode,
2294
- $metadata: deserializeMetadata(output),
2295
- };
2296
- break;
1596
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2297
1597
  default:
2298
1598
  const parsedBody = parsedOutput.body;
2299
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2300
- response = {
2301
- ...parsedBody,
2302
- name: `${errorCode}`,
2303
- message: parsedBody.message || parsedBody.Message || errorCode,
1599
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1600
+ name: parsedBody.code || parsedBody.Code || errorCode,
2304
1601
  $fault: "client",
2305
1602
  $metadata: deserializeMetadata(output),
2306
- };
1603
+ });
1604
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2307
1605
  }
2308
- const message = response.message || response.Message || errorCode;
2309
- response.message = message;
2310
- delete response.Message;
2311
- return Promise.reject(Object.assign(new Error(message), response));
2312
1606
  };
2313
1607
  const deserializeAws_json1_1SearchThingsCommand = async (output, context) => {
2314
1608
  if (output.statusCode >= 300) {
@@ -2335,51 +1629,25 @@ const deserializeAws_json1_1SearchThingsCommandError = async (output, context) =
2335
1629
  switch (errorCode) {
2336
1630
  case "InternalFailureException":
2337
1631
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2338
- response = {
2339
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2340
- name: errorCode,
2341
- $metadata: deserializeMetadata(output),
2342
- };
2343
- break;
1632
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2344
1633
  case "InvalidRequestException":
2345
1634
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2346
- response = {
2347
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2348
- name: errorCode,
2349
- $metadata: deserializeMetadata(output),
2350
- };
2351
- break;
1635
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2352
1636
  case "ResourceNotFoundException":
2353
1637
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
2354
- response = {
2355
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2356
- name: errorCode,
2357
- $metadata: deserializeMetadata(output),
2358
- };
2359
- break;
1638
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2360
1639
  case "ThrottlingException":
2361
1640
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2362
- response = {
2363
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2364
- name: errorCode,
2365
- $metadata: deserializeMetadata(output),
2366
- };
2367
- break;
1641
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2368
1642
  default:
2369
1643
  const parsedBody = parsedOutput.body;
2370
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2371
- response = {
2372
- ...parsedBody,
2373
- name: `${errorCode}`,
2374
- message: parsedBody.message || parsedBody.Message || errorCode,
1644
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1645
+ name: parsedBody.code || parsedBody.Code || errorCode,
2375
1646
  $fault: "client",
2376
1647
  $metadata: deserializeMetadata(output),
2377
- };
1648
+ });
1649
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2378
1650
  }
2379
- const message = response.message || response.Message || errorCode;
2380
- response.message = message;
2381
- delete response.Message;
2382
- return Promise.reject(Object.assign(new Error(message), response));
2383
1651
  };
2384
1652
  const deserializeAws_json1_1TagResourceCommand = async (output, context) => {
2385
1653
  if (output.statusCode >= 300) {
@@ -2406,51 +1674,25 @@ const deserializeAws_json1_1TagResourceCommandError = async (output, context) =>
2406
1674
  switch (errorCode) {
2407
1675
  case "InternalFailureException":
2408
1676
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2409
- response = {
2410
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2411
- name: errorCode,
2412
- $metadata: deserializeMetadata(output),
2413
- };
2414
- break;
1677
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2415
1678
  case "InvalidRequestException":
2416
1679
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2417
- response = {
2418
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2419
- name: errorCode,
2420
- $metadata: deserializeMetadata(output),
2421
- };
2422
- break;
1680
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2423
1681
  case "ResourceAlreadyExistsException":
2424
1682
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
2425
- response = {
2426
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
2427
- name: errorCode,
2428
- $metadata: deserializeMetadata(output),
2429
- };
2430
- break;
1683
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
2431
1684
  case "ThrottlingException":
2432
1685
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2433
- response = {
2434
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2435
- name: errorCode,
2436
- $metadata: deserializeMetadata(output),
2437
- };
2438
- break;
1686
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2439
1687
  default:
2440
1688
  const parsedBody = parsedOutput.body;
2441
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2442
- response = {
2443
- ...parsedBody,
2444
- name: `${errorCode}`,
2445
- message: parsedBody.message || parsedBody.Message || errorCode,
1689
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1690
+ name: parsedBody.code || parsedBody.Code || errorCode,
2446
1691
  $fault: "client",
2447
1692
  $metadata: deserializeMetadata(output),
2448
- };
1693
+ });
1694
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2449
1695
  }
2450
- const message = response.message || response.Message || errorCode;
2451
- response.message = message;
2452
- delete response.Message;
2453
- return Promise.reject(Object.assign(new Error(message), response));
2454
1696
  };
2455
1697
  const deserializeAws_json1_1UndeploySystemInstanceCommand = async (output, context) => {
2456
1698
  if (output.statusCode >= 300) {
@@ -2477,59 +1719,28 @@ const deserializeAws_json1_1UndeploySystemInstanceCommandError = async (output,
2477
1719
  switch (errorCode) {
2478
1720
  case "InternalFailureException":
2479
1721
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2480
- response = {
2481
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2482
- name: errorCode,
2483
- $metadata: deserializeMetadata(output),
2484
- };
2485
- break;
1722
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2486
1723
  case "InvalidRequestException":
2487
1724
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2488
- response = {
2489
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2490
- name: errorCode,
2491
- $metadata: deserializeMetadata(output),
2492
- };
2493
- break;
1725
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2494
1726
  case "ResourceInUseException":
2495
1727
  case "com.amazonaws.iotthingsgraph#ResourceInUseException":
2496
- response = {
2497
- ...(await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)),
2498
- name: errorCode,
2499
- $metadata: deserializeMetadata(output),
2500
- };
2501
- break;
1728
+ throw await deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context);
2502
1729
  case "ResourceNotFoundException":
2503
1730
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
2504
- response = {
2505
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2506
- name: errorCode,
2507
- $metadata: deserializeMetadata(output),
2508
- };
2509
- break;
1731
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2510
1732
  case "ThrottlingException":
2511
1733
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2512
- response = {
2513
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2514
- name: errorCode,
2515
- $metadata: deserializeMetadata(output),
2516
- };
2517
- break;
1734
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2518
1735
  default:
2519
1736
  const parsedBody = parsedOutput.body;
2520
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2521
- response = {
2522
- ...parsedBody,
2523
- name: `${errorCode}`,
2524
- message: parsedBody.message || parsedBody.Message || errorCode,
1737
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1738
+ name: parsedBody.code || parsedBody.Code || errorCode,
2525
1739
  $fault: "client",
2526
1740
  $metadata: deserializeMetadata(output),
2527
- };
1741
+ });
1742
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2528
1743
  }
2529
- const message = response.message || response.Message || errorCode;
2530
- response.message = message;
2531
- delete response.Message;
2532
- return Promise.reject(Object.assign(new Error(message), response));
2533
1744
  };
2534
1745
  const deserializeAws_json1_1UntagResourceCommand = async (output, context) => {
2535
1746
  if (output.statusCode >= 300) {
@@ -2556,51 +1767,25 @@ const deserializeAws_json1_1UntagResourceCommandError = async (output, context)
2556
1767
  switch (errorCode) {
2557
1768
  case "InternalFailureException":
2558
1769
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2559
- response = {
2560
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2561
- name: errorCode,
2562
- $metadata: deserializeMetadata(output),
2563
- };
2564
- break;
1770
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2565
1771
  case "InvalidRequestException":
2566
1772
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2567
- response = {
2568
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2569
- name: errorCode,
2570
- $metadata: deserializeMetadata(output),
2571
- };
2572
- break;
1773
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2573
1774
  case "ResourceAlreadyExistsException":
2574
1775
  case "com.amazonaws.iotthingsgraph#ResourceAlreadyExistsException":
2575
- response = {
2576
- ...(await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context)),
2577
- name: errorCode,
2578
- $metadata: deserializeMetadata(output),
2579
- };
2580
- break;
1776
+ throw await deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse(parsedOutput, context);
2581
1777
  case "ThrottlingException":
2582
1778
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2583
- response = {
2584
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2585
- name: errorCode,
2586
- $metadata: deserializeMetadata(output),
2587
- };
2588
- break;
1779
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2589
1780
  default:
2590
1781
  const parsedBody = parsedOutput.body;
2591
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2592
- response = {
2593
- ...parsedBody,
2594
- name: `${errorCode}`,
2595
- message: parsedBody.message || parsedBody.Message || errorCode,
1782
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1783
+ name: parsedBody.code || parsedBody.Code || errorCode,
2596
1784
  $fault: "client",
2597
1785
  $metadata: deserializeMetadata(output),
2598
- };
1786
+ });
1787
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2599
1788
  }
2600
- const message = response.message || response.Message || errorCode;
2601
- response.message = message;
2602
- delete response.Message;
2603
- return Promise.reject(Object.assign(new Error(message), response));
2604
1789
  };
2605
1790
  const deserializeAws_json1_1UpdateFlowTemplateCommand = async (output, context) => {
2606
1791
  if (output.statusCode >= 300) {
@@ -2627,51 +1812,25 @@ const deserializeAws_json1_1UpdateFlowTemplateCommandError = async (output, cont
2627
1812
  switch (errorCode) {
2628
1813
  case "InternalFailureException":
2629
1814
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2630
- response = {
2631
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2632
- name: errorCode,
2633
- $metadata: deserializeMetadata(output),
2634
- };
2635
- break;
1815
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2636
1816
  case "InvalidRequestException":
2637
1817
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2638
- response = {
2639
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2640
- name: errorCode,
2641
- $metadata: deserializeMetadata(output),
2642
- };
2643
- break;
1818
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2644
1819
  case "ResourceNotFoundException":
2645
1820
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
2646
- response = {
2647
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2648
- name: errorCode,
2649
- $metadata: deserializeMetadata(output),
2650
- };
2651
- break;
1821
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2652
1822
  case "ThrottlingException":
2653
1823
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2654
- response = {
2655
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2656
- name: errorCode,
2657
- $metadata: deserializeMetadata(output),
2658
- };
2659
- break;
1824
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2660
1825
  default:
2661
1826
  const parsedBody = parsedOutput.body;
2662
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2663
- response = {
2664
- ...parsedBody,
2665
- name: `${errorCode}`,
2666
- message: parsedBody.message || parsedBody.Message || errorCode,
1827
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1828
+ name: parsedBody.code || parsedBody.Code || errorCode,
2667
1829
  $fault: "client",
2668
1830
  $metadata: deserializeMetadata(output),
2669
- };
1831
+ });
1832
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2670
1833
  }
2671
- const message = response.message || response.Message || errorCode;
2672
- response.message = message;
2673
- delete response.Message;
2674
- return Promise.reject(Object.assign(new Error(message), response));
2675
1834
  };
2676
1835
  const deserializeAws_json1_1UpdateSystemTemplateCommand = async (output, context) => {
2677
1836
  if (output.statusCode >= 300) {
@@ -2698,51 +1857,25 @@ const deserializeAws_json1_1UpdateSystemTemplateCommandError = async (output, co
2698
1857
  switch (errorCode) {
2699
1858
  case "InternalFailureException":
2700
1859
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2701
- response = {
2702
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2703
- name: errorCode,
2704
- $metadata: deserializeMetadata(output),
2705
- };
2706
- break;
1860
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2707
1861
  case "InvalidRequestException":
2708
1862
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2709
- response = {
2710
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2711
- name: errorCode,
2712
- $metadata: deserializeMetadata(output),
2713
- };
2714
- break;
1863
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2715
1864
  case "ResourceNotFoundException":
2716
1865
  case "com.amazonaws.iotthingsgraph#ResourceNotFoundException":
2717
- response = {
2718
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2719
- name: errorCode,
2720
- $metadata: deserializeMetadata(output),
2721
- };
2722
- break;
1866
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
2723
1867
  case "ThrottlingException":
2724
1868
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2725
- response = {
2726
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2727
- name: errorCode,
2728
- $metadata: deserializeMetadata(output),
2729
- };
2730
- break;
1869
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2731
1870
  default:
2732
1871
  const parsedBody = parsedOutput.body;
2733
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2734
- response = {
2735
- ...parsedBody,
2736
- name: `${errorCode}`,
2737
- message: parsedBody.message || parsedBody.Message || errorCode,
1872
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1873
+ name: parsedBody.code || parsedBody.Code || errorCode,
2738
1874
  $fault: "client",
2739
1875
  $metadata: deserializeMetadata(output),
2740
- };
1876
+ });
1877
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2741
1878
  }
2742
- const message = response.message || response.Message || errorCode;
2743
- response.message = message;
2744
- delete response.Message;
2745
- return Promise.reject(Object.assign(new Error(message), response));
2746
1879
  };
2747
1880
  const deserializeAws_json1_1UploadEntityDefinitionsCommand = async (output, context) => {
2748
1881
  if (output.statusCode >= 300) {
@@ -2769,120 +1902,85 @@ const deserializeAws_json1_1UploadEntityDefinitionsCommandError = async (output,
2769
1902
  switch (errorCode) {
2770
1903
  case "InternalFailureException":
2771
1904
  case "com.amazonaws.iotthingsgraph#InternalFailureException":
2772
- response = {
2773
- ...(await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context)),
2774
- name: errorCode,
2775
- $metadata: deserializeMetadata(output),
2776
- };
2777
- break;
1905
+ throw await deserializeAws_json1_1InternalFailureExceptionResponse(parsedOutput, context);
2778
1906
  case "InvalidRequestException":
2779
1907
  case "com.amazonaws.iotthingsgraph#InvalidRequestException":
2780
- response = {
2781
- ...(await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)),
2782
- name: errorCode,
2783
- $metadata: deserializeMetadata(output),
2784
- };
2785
- break;
1908
+ throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context);
2786
1909
  case "ThrottlingException":
2787
1910
  case "com.amazonaws.iotthingsgraph#ThrottlingException":
2788
- response = {
2789
- ...(await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context)),
2790
- name: errorCode,
2791
- $metadata: deserializeMetadata(output),
2792
- };
2793
- break;
1911
+ throw await deserializeAws_json1_1ThrottlingExceptionResponse(parsedOutput, context);
2794
1912
  default:
2795
1913
  const parsedBody = parsedOutput.body;
2796
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2797
- response = {
2798
- ...parsedBody,
2799
- name: `${errorCode}`,
2800
- message: parsedBody.message || parsedBody.Message || errorCode,
1914
+ response = new IoTThingsGraphServiceException_1.IoTThingsGraphServiceException({
1915
+ name: parsedBody.code || parsedBody.Code || errorCode,
2801
1916
  $fault: "client",
2802
1917
  $metadata: deserializeMetadata(output),
2803
- };
1918
+ });
1919
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2804
1920
  }
2805
- const message = response.message || response.Message || errorCode;
2806
- response.message = message;
2807
- delete response.Message;
2808
- return Promise.reject(Object.assign(new Error(message), response));
2809
1921
  };
2810
1922
  const deserializeAws_json1_1InternalFailureExceptionResponse = async (parsedOutput, context) => {
2811
1923
  const body = parsedOutput.body;
2812
1924
  const deserialized = deserializeAws_json1_1InternalFailureException(body, context);
2813
- const contents = {
2814
- name: "InternalFailureException",
2815
- $fault: "server",
1925
+ const exception = new models_0_1.InternalFailureException({
2816
1926
  $metadata: deserializeMetadata(parsedOutput),
2817
1927
  ...deserialized,
2818
- };
2819
- return contents;
1928
+ });
1929
+ return smithy_client_1.decorateServiceException(exception, body);
2820
1930
  };
2821
1931
  const deserializeAws_json1_1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
2822
1932
  const body = parsedOutput.body;
2823
1933
  const deserialized = deserializeAws_json1_1InvalidRequestException(body, context);
2824
- const contents = {
2825
- name: "InvalidRequestException",
2826
- $fault: "client",
1934
+ const exception = new models_0_1.InvalidRequestException({
2827
1935
  $metadata: deserializeMetadata(parsedOutput),
2828
1936
  ...deserialized,
2829
- };
2830
- return contents;
1937
+ });
1938
+ return smithy_client_1.decorateServiceException(exception, body);
2831
1939
  };
2832
1940
  const deserializeAws_json1_1LimitExceededExceptionResponse = async (parsedOutput, context) => {
2833
1941
  const body = parsedOutput.body;
2834
1942
  const deserialized = deserializeAws_json1_1LimitExceededException(body, context);
2835
- const contents = {
2836
- name: "LimitExceededException",
2837
- $fault: "client",
1943
+ const exception = new models_0_1.LimitExceededException({
2838
1944
  $metadata: deserializeMetadata(parsedOutput),
2839
1945
  ...deserialized,
2840
- };
2841
- return contents;
1946
+ });
1947
+ return smithy_client_1.decorateServiceException(exception, body);
2842
1948
  };
2843
1949
  const deserializeAws_json1_1ResourceAlreadyExistsExceptionResponse = async (parsedOutput, context) => {
2844
1950
  const body = parsedOutput.body;
2845
1951
  const deserialized = deserializeAws_json1_1ResourceAlreadyExistsException(body, context);
2846
- const contents = {
2847
- name: "ResourceAlreadyExistsException",
2848
- $fault: "client",
1952
+ const exception = new models_0_1.ResourceAlreadyExistsException({
2849
1953
  $metadata: deserializeMetadata(parsedOutput),
2850
1954
  ...deserialized,
2851
- };
2852
- return contents;
1955
+ });
1956
+ return smithy_client_1.decorateServiceException(exception, body);
2853
1957
  };
2854
1958
  const deserializeAws_json1_1ResourceInUseExceptionResponse = async (parsedOutput, context) => {
2855
1959
  const body = parsedOutput.body;
2856
1960
  const deserialized = deserializeAws_json1_1ResourceInUseException(body, context);
2857
- const contents = {
2858
- name: "ResourceInUseException",
2859
- $fault: "client",
1961
+ const exception = new models_0_1.ResourceInUseException({
2860
1962
  $metadata: deserializeMetadata(parsedOutput),
2861
1963
  ...deserialized,
2862
- };
2863
- return contents;
1964
+ });
1965
+ return smithy_client_1.decorateServiceException(exception, body);
2864
1966
  };
2865
1967
  const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2866
1968
  const body = parsedOutput.body;
2867
1969
  const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
2868
- const contents = {
2869
- name: "ResourceNotFoundException",
2870
- $fault: "client",
1970
+ const exception = new models_0_1.ResourceNotFoundException({
2871
1971
  $metadata: deserializeMetadata(parsedOutput),
2872
1972
  ...deserialized,
2873
- };
2874
- return contents;
1973
+ });
1974
+ return smithy_client_1.decorateServiceException(exception, body);
2875
1975
  };
2876
1976
  const deserializeAws_json1_1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2877
1977
  const body = parsedOutput.body;
2878
1978
  const deserialized = deserializeAws_json1_1ThrottlingException(body, context);
2879
- const contents = {
2880
- name: "ThrottlingException",
2881
- $fault: "client",
1979
+ const exception = new models_0_1.ThrottlingException({
2882
1980
  $metadata: deserializeMetadata(parsedOutput),
2883
1981
  ...deserialized,
2884
- };
2885
- return contents;
1982
+ });
1983
+ return smithy_client_1.decorateServiceException(exception, body);
2886
1984
  };
2887
1985
  const serializeAws_json1_1AssociateEntityToThingRequest = (input, context) => {
2888
1986
  return {
@@ -3357,7 +2455,7 @@ const deserializeAws_json1_1DependencyRevision = (output, context) => {
3357
2455
  };
3358
2456
  };
3359
2457
  const deserializeAws_json1_1DependencyRevisions = (output, context) => {
3360
- return (output || [])
2458
+ const retVal = (output || [])
3361
2459
  .filter((e) => e != null)
3362
2460
  .map((entry) => {
3363
2461
  if (entry === null) {
@@ -3365,6 +2463,7 @@ const deserializeAws_json1_1DependencyRevisions = (output, context) => {
3365
2463
  }
3366
2464
  return deserializeAws_json1_1DependencyRevision(entry, context);
3367
2465
  });
2466
+ return retVal;
3368
2467
  };
3369
2468
  const deserializeAws_json1_1DeploySystemInstanceResponse = (output, context) => {
3370
2469
  return {
@@ -3406,7 +2505,7 @@ const deserializeAws_json1_1EntityDescription = (output, context) => {
3406
2505
  };
3407
2506
  };
3408
2507
  const deserializeAws_json1_1EntityDescriptions = (output, context) => {
3409
- return (output || [])
2508
+ const retVal = (output || [])
3410
2509
  .filter((e) => e != null)
3411
2510
  .map((entry) => {
3412
2511
  if (entry === null) {
@@ -3414,6 +2513,7 @@ const deserializeAws_json1_1EntityDescriptions = (output, context) => {
3414
2513
  }
3415
2514
  return deserializeAws_json1_1EntityDescription(entry, context);
3416
2515
  });
2516
+ return retVal;
3417
2517
  };
3418
2518
  const deserializeAws_json1_1FlowExecutionMessage = (output, context) => {
3419
2519
  return {
@@ -3426,7 +2526,7 @@ const deserializeAws_json1_1FlowExecutionMessage = (output, context) => {
3426
2526
  };
3427
2527
  };
3428
2528
  const deserializeAws_json1_1FlowExecutionMessages = (output, context) => {
3429
- return (output || [])
2529
+ const retVal = (output || [])
3430
2530
  .filter((e) => e != null)
3431
2531
  .map((entry) => {
3432
2532
  if (entry === null) {
@@ -3434,9 +2534,10 @@ const deserializeAws_json1_1FlowExecutionMessages = (output, context) => {
3434
2534
  }
3435
2535
  return deserializeAws_json1_1FlowExecutionMessage(entry, context);
3436
2536
  });
2537
+ return retVal;
3437
2538
  };
3438
2539
  const deserializeAws_json1_1FlowExecutionSummaries = (output, context) => {
3439
- return (output || [])
2540
+ const retVal = (output || [])
3440
2541
  .filter((e) => e != null)
3441
2542
  .map((entry) => {
3442
2543
  if (entry === null) {
@@ -3444,6 +2545,7 @@ const deserializeAws_json1_1FlowExecutionSummaries = (output, context) => {
3444
2545
  }
3445
2546
  return deserializeAws_json1_1FlowExecutionSummary(entry, context);
3446
2547
  });
2548
+ return retVal;
3447
2549
  };
3448
2550
  const deserializeAws_json1_1FlowExecutionSummary = (output, context) => {
3449
2551
  return {
@@ -3471,7 +2573,7 @@ const deserializeAws_json1_1FlowTemplateDescription = (output, context) => {
3471
2573
  };
3472
2574
  };
3473
2575
  const deserializeAws_json1_1FlowTemplateSummaries = (output, context) => {
3474
- return (output || [])
2576
+ const retVal = (output || [])
3475
2577
  .filter((e) => e != null)
3476
2578
  .map((entry) => {
3477
2579
  if (entry === null) {
@@ -3479,6 +2581,7 @@ const deserializeAws_json1_1FlowTemplateSummaries = (output, context) => {
3479
2581
  }
3480
2582
  return deserializeAws_json1_1FlowTemplateSummary(entry, context);
3481
2583
  });
2584
+ return retVal;
3482
2585
  };
3483
2586
  const deserializeAws_json1_1FlowTemplateSummary = (output, context) => {
3484
2587
  return {
@@ -3659,7 +2762,7 @@ const deserializeAws_json1_1SearchThingsResponse = (output, context) => {
3659
2762
  };
3660
2763
  };
3661
2764
  const deserializeAws_json1_1StringList = (output, context) => {
3662
- return (output || [])
2765
+ const retVal = (output || [])
3663
2766
  .filter((e) => e != null)
3664
2767
  .map((entry) => {
3665
2768
  if (entry === null) {
@@ -3667,6 +2770,7 @@ const deserializeAws_json1_1StringList = (output, context) => {
3667
2770
  }
3668
2771
  return smithy_client_1.expectString(entry);
3669
2772
  });
2773
+ return retVal;
3670
2774
  };
3671
2775
  const deserializeAws_json1_1SystemInstanceDescription = (output, context) => {
3672
2776
  return {
@@ -3688,7 +2792,7 @@ const deserializeAws_json1_1SystemInstanceDescription = (output, context) => {
3688
2792
  };
3689
2793
  };
3690
2794
  const deserializeAws_json1_1SystemInstanceSummaries = (output, context) => {
3691
- return (output || [])
2795
+ const retVal = (output || [])
3692
2796
  .filter((e) => e != null)
3693
2797
  .map((entry) => {
3694
2798
  if (entry === null) {
@@ -3696,6 +2800,7 @@ const deserializeAws_json1_1SystemInstanceSummaries = (output, context) => {
3696
2800
  }
3697
2801
  return deserializeAws_json1_1SystemInstanceSummary(entry, context);
3698
2802
  });
2803
+ return retVal;
3699
2804
  };
3700
2805
  const deserializeAws_json1_1SystemInstanceSummary = (output, context) => {
3701
2806
  return {
@@ -3726,7 +2831,7 @@ const deserializeAws_json1_1SystemTemplateDescription = (output, context) => {
3726
2831
  };
3727
2832
  };
3728
2833
  const deserializeAws_json1_1SystemTemplateSummaries = (output, context) => {
3729
- return (output || [])
2834
+ const retVal = (output || [])
3730
2835
  .filter((e) => e != null)
3731
2836
  .map((entry) => {
3732
2837
  if (entry === null) {
@@ -3734,6 +2839,7 @@ const deserializeAws_json1_1SystemTemplateSummaries = (output, context) => {
3734
2839
  }
3735
2840
  return deserializeAws_json1_1SystemTemplateSummary(entry, context);
3736
2841
  });
2842
+ return retVal;
3737
2843
  };
3738
2844
  const deserializeAws_json1_1SystemTemplateSummary = (output, context) => {
3739
2845
  return {
@@ -3752,7 +2858,7 @@ const deserializeAws_json1_1Tag = (output, context) => {
3752
2858
  };
3753
2859
  };
3754
2860
  const deserializeAws_json1_1TagList = (output, context) => {
3755
- return (output || [])
2861
+ const retVal = (output || [])
3756
2862
  .filter((e) => e != null)
3757
2863
  .map((entry) => {
3758
2864
  if (entry === null) {
@@ -3760,6 +2866,7 @@ const deserializeAws_json1_1TagList = (output, context) => {
3760
2866
  }
3761
2867
  return deserializeAws_json1_1Tag(entry, context);
3762
2868
  });
2869
+ return retVal;
3763
2870
  };
3764
2871
  const deserializeAws_json1_1TagResourceResponse = (output, context) => {
3765
2872
  return {};
@@ -3771,7 +2878,7 @@ const deserializeAws_json1_1Thing = (output, context) => {
3771
2878
  };
3772
2879
  };
3773
2880
  const deserializeAws_json1_1Things = (output, context) => {
3774
- return (output || [])
2881
+ const retVal = (output || [])
3775
2882
  .filter((e) => e != null)
3776
2883
  .map((entry) => {
3777
2884
  if (entry === null) {
@@ -3779,6 +2886,7 @@ const deserializeAws_json1_1Things = (output, context) => {
3779
2886
  }
3780
2887
  return deserializeAws_json1_1Thing(entry, context);
3781
2888
  });
2889
+ return retVal;
3782
2890
  };
3783
2891
  const deserializeAws_json1_1ThrottlingException = (output, context) => {
3784
2892
  return {