Skip to content

Commit 1ffee0e

Browse files
committed
fix(codegen): codegen safe access for error code location
1 parent 4229ee0 commit 1ffee0e

File tree

25 files changed

+50
-50
lines changed

25 files changed

+50
-50
lines changed

clients/client-auto-scaling/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10652,8 +10652,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1065210652
.join("&");
1065310653

1065410654
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
10655-
if (data.Error.Code !== undefined) {
10656-
return data.Error.Code;
10655+
if (data.Error?.Code !== undefined) {
10656+
return data.Error?.Code;
1065710657
}
1065810658
if (output.statusCode == 404) {
1065910659
return "NotFound";

clients/client-cloudformation/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10498,8 +10498,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1049810498
.join("&");
1049910499

1050010500
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
10501-
if (data.Error.Code !== undefined) {
10502-
return data.Error.Code;
10501+
if (data.Error?.Code !== undefined) {
10502+
return data.Error?.Code;
1050310503
}
1050410504
if (output.statusCode == 404) {
1050510505
return "NotFound";

clients/client-cloudfront/src/protocols/Aws_restXml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18922,8 +18922,8 @@ const parseErrorBody = async (errorBody: any, context: __SerdeContext) => {
1892218922
};
1892318923

1892418924
const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string | undefined => {
18925-
if (data.Error.Code !== undefined) {
18926-
return data.Error.Code;
18925+
if (data.Error?.Code !== undefined) {
18926+
return data.Error?.Code;
1892718927
}
1892818928
if (output.statusCode == 404) {
1892918929
return "NotFound";

clients/client-cloudsearch/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,8 +4236,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
42364236
.join("&");
42374237

42384238
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
4239-
if (data.Error.Code !== undefined) {
4240-
return data.Error.Code;
4239+
if (data.Error?.Code !== undefined) {
4240+
return data.Error?.Code;
42414241
}
42424242
if (output.statusCode == 404) {
42434243
return "NotFound";

clients/client-cloudwatch/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6418,8 +6418,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
64186418
.join("&");
64196419

64206420
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
6421-
if (data.Error.Code !== undefined) {
6422-
return data.Error.Code;
6421+
if (data.Error?.Code !== undefined) {
6422+
return data.Error?.Code;
64236423
}
64246424
if (output.statusCode == 404) {
64256425
return "NotFound";

clients/client-docdb/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9269,8 +9269,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
92699269
.join("&");
92709270

92719271
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
9272-
if (data.Error.Code !== undefined) {
9273-
return data.Error.Code;
9272+
if (data.Error?.Code !== undefined) {
9273+
return data.Error?.Code;
92749274
}
92759275
if (output.statusCode == 404) {
92769276
return "NotFound";

clients/client-ec2/src/protocols/Aws_ec2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88326,8 +88326,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
8832688326
.join("&");
8832788327

8832888328
const loadEc2ErrorCode = (output: __HttpResponse, data: any): string | undefined => {
88329-
if (data.Errors.Error.Code !== undefined) {
88330-
return data.Errors.Error.Code;
88329+
if (data.Errors.Error?.Code !== undefined) {
88330+
return data.Errors.Error?.Code;
8833188331
}
8833288332
if (output.statusCode == 404) {
8833388333
return "NotFound";

clients/client-elastic-beanstalk/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7400,8 +7400,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
74007400
.join("&");
74017401

74027402
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
7403-
if (data.Error.Code !== undefined) {
7404-
return data.Error.Code;
7403+
if (data.Error?.Code !== undefined) {
7404+
return data.Error?.Code;
74057405
}
74067406
if (output.statusCode == 404) {
74077407
return "NotFound";

clients/client-elastic-load-balancing-v2/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6880,8 +6880,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
68806880
.join("&");
68816881

68826882
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
6883-
if (data.Error.Code !== undefined) {
6884-
return data.Error.Code;
6883+
if (data.Error?.Code !== undefined) {
6884+
return data.Error?.Code;
68856885
}
68866886
if (output.statusCode == 404) {
68876887
return "NotFound";

clients/client-elastic-load-balancing/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4775,8 +4775,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
47754775
.join("&");
47764776

47774777
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
4778-
if (data.Error.Code !== undefined) {
4779-
return data.Error.Code;
4778+
if (data.Error?.Code !== undefined) {
4779+
return data.Error?.Code;
47804780
}
47814781
if (output.statusCode == 404) {
47824782
return "NotFound";

clients/client-elasticache/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12878,8 +12878,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1287812878
.join("&");
1287912879

1288012880
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
12881-
if (data.Error.Code !== undefined) {
12882-
return data.Error.Code;
12881+
if (data.Error?.Code !== undefined) {
12882+
return data.Error?.Code;
1288312883
}
1288412884
if (output.statusCode == 404) {
1288512885
return "NotFound";

clients/client-iam/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17534,8 +17534,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1753417534
.join("&");
1753517535

1753617536
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
17537-
if (data.Error.Code !== undefined) {
17538-
return data.Error.Code;
17537+
if (data.Error?.Code !== undefined) {
17538+
return data.Error?.Code;
1753917539
}
1754017540
if (output.statusCode == 404) {
1754117541
return "NotFound";

clients/client-neptune/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12367,8 +12367,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1236712367
.join("&");
1236812368

1236912369
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
12370-
if (data.Error.Code !== undefined) {
12371-
return data.Error.Code;
12370+
if (data.Error?.Code !== undefined) {
12371+
return data.Error?.Code;
1237212372
}
1237312373
if (output.statusCode == 404) {
1237412374
return "NotFound";

clients/client-rds/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25607,8 +25607,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
2560725607
.join("&");
2560825608

2560925609
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
25610-
if (data.Error.Code !== undefined) {
25611-
return data.Error.Code;
25610+
if (data.Error?.Code !== undefined) {
25611+
return data.Error?.Code;
2561225612
}
2561325613
if (output.statusCode == 404) {
2561425614
return "NotFound";

clients/client-redshift/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19645,8 +19645,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
1964519645
.join("&");
1964619646

1964719647
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
19648-
if (data.Error.Code !== undefined) {
19649-
return data.Error.Code;
19648+
if (data.Error?.Code !== undefined) {
19649+
return data.Error?.Code;
1965019650
}
1965119651
if (output.statusCode == 404) {
1965219652
return "NotFound";

clients/client-route-53/src/protocols/Aws_restXml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8985,8 +8985,8 @@ const parseErrorBody = async (errorBody: any, context: __SerdeContext) => {
89858985
};
89868986

89878987
const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string | undefined => {
8988-
if (data.Error.Code !== undefined) {
8989-
return data.Error.Code;
8988+
if (data.Error?.Code !== undefined) {
8989+
return data.Error?.Code;
89908990
}
89918991
if (output.statusCode == 404) {
89928992
return "NotFound";

clients/client-s3-control/src/protocols/Aws_restXml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9064,8 +9064,8 @@ const parseErrorBody = async (errorBody: any, context: __SerdeContext) => {
90649064
};
90659065

90669066
const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string | undefined => {
9067-
if (data.Error.Code !== undefined) {
9068-
return data.Error.Code;
9067+
if (data.Error?.Code !== undefined) {
9068+
return data.Error?.Code;
90699069
}
90709070
if (output.statusCode == 404) {
90719071
return "NotFound";

clients/client-s3/src/protocols/Aws_restXml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12066,8 +12066,8 @@ const parseErrorBody = async (errorBody: any, context: __SerdeContext) => {
1206612066
};
1206712067

1206812068
const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string | undefined => {
12069-
if (data.Code !== undefined) {
12070-
return data.Code;
12069+
if (data?.Code !== undefined) {
12070+
return data?.Code;
1207112071
}
1207212072
if (output.statusCode == 404) {
1207312073
return "NotFound";

clients/client-ses/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9106,8 +9106,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
91069106
.join("&");
91079107

91089108
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
9109-
if (data.Error.Code !== undefined) {
9110-
return data.Error.Code;
9109+
if (data.Error?.Code !== undefined) {
9110+
return data.Error?.Code;
91119111
}
91129112
if (output.statusCode == 404) {
91139113
return "NotFound";

clients/client-sns/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5627,8 +5627,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
56275627
.join("&");
56285628

56295629
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
5630-
if (data.Error.Code !== undefined) {
5631-
return data.Error.Code;
5630+
if (data.Error?.Code !== undefined) {
5631+
return data.Error?.Code;
56325632
}
56335633
if (output.statusCode == 404) {
56345634
return "NotFound";

clients/client-sqs/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2809,8 +2809,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
28092809
.join("&");
28102810

28112811
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
2812-
if (data.Error.Code !== undefined) {
2813-
return data.Error.Code;
2812+
if (data.Error?.Code !== undefined) {
2813+
return data.Error?.Code;
28142814
}
28152815
if (output.statusCode == 404) {
28162816
return "NotFound";

clients/client-sts/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
13441344
.join("&");
13451345

13461346
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
1347-
if (data.Error.Code !== undefined) {
1348-
return data.Error.Code;
1347+
if (data.Error?.Code !== undefined) {
1348+
return data.Error?.Code;
13491349
}
13501350
if (output.statusCode == 404) {
13511351
return "NotFound";

private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
21402140
.join("&");
21412141

21422142
const loadEc2ErrorCode = (output: __HttpResponse, data: any): string | undefined => {
2143-
if (data.Errors.Error.Code !== undefined) {
2144-
return data.Errors.Error.Code;
2143+
if (data.Errors.Error?.Code !== undefined) {
2144+
return data.Errors.Error?.Code;
21452145
}
21462146
if (output.statusCode == 404) {
21472147
return "NotFound";

private/aws-protocoltests-query/src/protocols/Aws_query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,8 +2874,8 @@ const buildFormUrlencodedString = (formEntries: Record<string, string>): string
28742874
.join("&");
28752875

28762876
const loadQueryErrorCode = (output: __HttpResponse, data: any): string | undefined => {
2877-
if (data.Error.Code !== undefined) {
2878-
return data.Error.Code;
2877+
if (data.Error?.Code !== undefined) {
2878+
return data.Error?.Code;
28792879
}
28802880
if (output.statusCode == 404) {
28812881
return "NotFound";

private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5554,8 +5554,8 @@ const parseErrorBody = async (errorBody: any, context: __SerdeContext) => {
55545554
};
55555555

55565556
const loadRestXmlErrorCode = (output: __HttpResponse, data: any): string | undefined => {
5557-
if (data.Error.Code !== undefined) {
5558-
return data.Error.Code;
5557+
if (data.Error?.Code !== undefined) {
5558+
return data.Error?.Code;
55595559
}
55605560
if (output.statusCode == 404) {
55615561
return "NotFound";

0 commit comments

Comments
 (0)