@@ -13,6 +13,7 @@ import {
13
13
ResponseContext ,
14
14
} from "../../datadog-api-client-common/http/http" ;
15
15
16
+ import { logger } from "../../../logger" ;
16
17
import { ObjectSerializer } from "../models/ObjectSerializer" ;
17
18
import { ApiException } from "../../datadog-api-client-common/exception" ;
18
19
@@ -455,11 +456,23 @@ export class AWSIntegrationApiResponseProcessor {
455
456
response . httpStatusCode == 409 ||
456
457
response . httpStatusCode == 429
457
458
) {
458
- const body : APIErrorResponse = ObjectSerializer . deserialize (
459
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
460
- "APIErrorResponse"
461
- ) as APIErrorResponse ;
462
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
459
+ const bodyText = ObjectSerializer . parse (
460
+ await response . body . text ( ) ,
461
+ contentType
462
+ ) ;
463
+ try {
464
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
465
+ bodyText ,
466
+ "APIErrorResponse"
467
+ ) as APIErrorResponse ;
468
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
469
+ } catch ( error ) {
470
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
471
+ throw new ApiException < APIErrorResponse > (
472
+ response . httpStatusCode ,
473
+ bodyText
474
+ ) ;
475
+ }
463
476
}
464
477
465
478
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -502,11 +515,23 @@ export class AWSIntegrationApiResponseProcessor {
502
515
response . httpStatusCode == 403 ||
503
516
response . httpStatusCode == 429
504
517
) {
505
- const body : APIErrorResponse = ObjectSerializer . deserialize (
506
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
507
- "APIErrorResponse"
508
- ) as APIErrorResponse ;
509
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
518
+ const bodyText = ObjectSerializer . parse (
519
+ await response . body . text ( ) ,
520
+ contentType
521
+ ) ;
522
+ try {
523
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
524
+ bodyText ,
525
+ "APIErrorResponse"
526
+ ) as APIErrorResponse ;
527
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
528
+ } catch ( error ) {
529
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
530
+ throw new ApiException < APIErrorResponse > (
531
+ response . httpStatusCode ,
532
+ bodyText
533
+ ) ;
534
+ }
510
535
}
511
536
512
537
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -551,11 +576,23 @@ export class AWSIntegrationApiResponseProcessor {
551
576
response . httpStatusCode == 403 ||
552
577
response . httpStatusCode == 429
553
578
) {
554
- const body : APIErrorResponse = ObjectSerializer . deserialize (
555
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
556
- "APIErrorResponse"
557
- ) as APIErrorResponse ;
558
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
579
+ const bodyText = ObjectSerializer . parse (
580
+ await response . body . text ( ) ,
581
+ contentType
582
+ ) ;
583
+ try {
584
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
585
+ bodyText ,
586
+ "APIErrorResponse"
587
+ ) as APIErrorResponse ;
588
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
589
+ } catch ( error ) {
590
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
591
+ throw new ApiException < APIErrorResponse > (
592
+ response . httpStatusCode ,
593
+ bodyText
594
+ ) ;
595
+ }
559
596
}
560
597
561
598
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -599,11 +636,23 @@ export class AWSIntegrationApiResponseProcessor {
599
636
response . httpStatusCode == 409 ||
600
637
response . httpStatusCode == 429
601
638
) {
602
- const body : APIErrorResponse = ObjectSerializer . deserialize (
603
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
604
- "APIErrorResponse"
605
- ) as APIErrorResponse ;
606
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
639
+ const bodyText = ObjectSerializer . parse (
640
+ await response . body . text ( ) ,
641
+ contentType
642
+ ) ;
643
+ try {
644
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
645
+ bodyText ,
646
+ "APIErrorResponse"
647
+ ) as APIErrorResponse ;
648
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
649
+ } catch ( error ) {
650
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
651
+ throw new ApiException < APIErrorResponse > (
652
+ response . httpStatusCode ,
653
+ bodyText
654
+ ) ;
655
+ }
607
656
}
608
657
609
658
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -646,11 +695,23 @@ export class AWSIntegrationApiResponseProcessor {
646
695
response . httpStatusCode == 403 ||
647
696
response . httpStatusCode == 429
648
697
) {
649
- const body : APIErrorResponse = ObjectSerializer . deserialize (
650
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
651
- "APIErrorResponse"
652
- ) as APIErrorResponse ;
653
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
698
+ const bodyText = ObjectSerializer . parse (
699
+ await response . body . text ( ) ,
700
+ contentType
701
+ ) ;
702
+ try {
703
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
704
+ bodyText ,
705
+ "APIErrorResponse"
706
+ ) as APIErrorResponse ;
707
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
708
+ } catch ( error ) {
709
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
710
+ throw new ApiException < APIErrorResponse > (
711
+ response . httpStatusCode ,
712
+ bodyText
713
+ ) ;
714
+ }
654
715
}
655
716
656
717
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -691,11 +752,23 @@ export class AWSIntegrationApiResponseProcessor {
691
752
return body ;
692
753
}
693
754
if ( response . httpStatusCode == 403 || response . httpStatusCode == 429 ) {
694
- const body : APIErrorResponse = ObjectSerializer . deserialize (
695
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
696
- "APIErrorResponse"
697
- ) as APIErrorResponse ;
698
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
755
+ const bodyText = ObjectSerializer . parse (
756
+ await response . body . text ( ) ,
757
+ contentType
758
+ ) ;
759
+ try {
760
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
761
+ bodyText ,
762
+ "APIErrorResponse"
763
+ ) as APIErrorResponse ;
764
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
765
+ } catch ( error ) {
766
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
767
+ throw new ApiException < APIErrorResponse > (
768
+ response . httpStatusCode ,
769
+ bodyText
770
+ ) ;
771
+ }
699
772
}
700
773
701
774
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -740,11 +813,23 @@ export class AWSIntegrationApiResponseProcessor {
740
813
response . httpStatusCode == 403 ||
741
814
response . httpStatusCode == 429
742
815
) {
743
- const body : APIErrorResponse = ObjectSerializer . deserialize (
744
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
745
- "APIErrorResponse"
746
- ) as APIErrorResponse ;
747
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
816
+ const bodyText = ObjectSerializer . parse (
817
+ await response . body . text ( ) ,
818
+ contentType
819
+ ) ;
820
+ try {
821
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
822
+ bodyText ,
823
+ "APIErrorResponse"
824
+ ) as APIErrorResponse ;
825
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
826
+ } catch ( error ) {
827
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
828
+ throw new ApiException < APIErrorResponse > (
829
+ response . httpStatusCode ,
830
+ bodyText
831
+ ) ;
832
+ }
748
833
}
749
834
750
835
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -789,11 +874,23 @@ export class AWSIntegrationApiResponseProcessor {
789
874
response . httpStatusCode == 403 ||
790
875
response . httpStatusCode == 429
791
876
) {
792
- const body : APIErrorResponse = ObjectSerializer . deserialize (
793
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
794
- "APIErrorResponse"
795
- ) as APIErrorResponse ;
796
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
877
+ const bodyText = ObjectSerializer . parse (
878
+ await response . body . text ( ) ,
879
+ contentType
880
+ ) ;
881
+ try {
882
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
883
+ bodyText ,
884
+ "APIErrorResponse"
885
+ ) as APIErrorResponse ;
886
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
887
+ } catch ( error ) {
888
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
889
+ throw new ApiException < APIErrorResponse > (
890
+ response . httpStatusCode ,
891
+ bodyText
892
+ ) ;
893
+ }
797
894
}
798
895
799
896
// Work around for missing responses in specification, e.g. for petstore.yaml
@@ -837,11 +934,23 @@ export class AWSIntegrationApiResponseProcessor {
837
934
response . httpStatusCode == 409 ||
838
935
response . httpStatusCode == 429
839
936
) {
840
- const body : APIErrorResponse = ObjectSerializer . deserialize (
841
- ObjectSerializer . parse ( await response . body . text ( ) , contentType ) ,
842
- "APIErrorResponse"
843
- ) as APIErrorResponse ;
844
- throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
937
+ const bodyText = ObjectSerializer . parse (
938
+ await response . body . text ( ) ,
939
+ contentType
940
+ ) ;
941
+ try {
942
+ const body : APIErrorResponse = ObjectSerializer . deserialize (
943
+ bodyText ,
944
+ "APIErrorResponse"
945
+ ) as APIErrorResponse ;
946
+ throw new ApiException < APIErrorResponse > ( response . httpStatusCode , body ) ;
947
+ } catch ( error ) {
948
+ logger . info ( `Got error deserializing error: ${ error } ` ) ;
949
+ throw new ApiException < APIErrorResponse > (
950
+ response . httpStatusCode ,
951
+ bodyText
952
+ ) ;
953
+ }
845
954
}
846
955
847
956
// Work around for missing responses in specification, e.g. for petstore.yaml
0 commit comments