Skip to content

Commit 0872087

Browse files
authored
feat: unified error dispatcher in protocols (#5756)
* feat: error serde * chore: update codegen diff * chore: update smithy hash with small fix * chore: update codegen w/ as never
1 parent 2da1b6c commit 0872087

File tree

385 files changed

+83018
-609382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+83018
-609382
lines changed

clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts

Lines changed: 194 additions & 1372 deletions
Large diffs are not rendered by default.

clients/client-account/src/protocols/Aws_restJson1.ts

Lines changed: 18 additions & 310 deletions
Large diffs are not rendered by default.

clients/client-acm-pca/src/protocols/Aws_json1_1.ts

Lines changed: 111 additions & 893 deletions
Large diffs are not rendered by default.

clients/client-acm/src/protocols/Aws_json1_1.ts

Lines changed: 60 additions & 520 deletions
Large diffs are not rendered by default.

clients/client-alexa-for-business/src/protocols/Aws_json1_1.ts

Lines changed: 412 additions & 2873 deletions
Large diffs are not rendered by default.

clients/client-amp/src/protocols/Aws_restJson1.ts

Lines changed: 137 additions & 1117 deletions
Large diffs are not rendered by default.

clients/client-amplify/src/protocols/Aws_restJson1.ts

Lines changed: 69 additions & 1365 deletions
Large diffs are not rendered by default.

clients/client-amplifybackend/src/protocols/Aws_restJson1.ts

Lines changed: 67 additions & 1120 deletions
Large diffs are not rendered by default.

clients/client-amplifyuibuilder/src/protocols/Aws_restJson1.ts

Lines changed: 71 additions & 806 deletions
Large diffs are not rendered by default.

clients/client-api-gateway/src/protocols/Aws_restJson1.ts

Lines changed: 429 additions & 4963 deletions
Large diffs are not rendered by default.

clients/client-apigatewaymanagementapi/src/protocols/Aws_restJson1.ts

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const de_DeleteConnectionCommand = async (
9393
context: __SerdeContext
9494
): Promise<DeleteConnectionCommandOutput> => {
9595
if (output.statusCode !== 204 && output.statusCode >= 300) {
96-
return de_DeleteConnectionCommandError(output, context);
96+
return de_CommandError(output, context);
9797
}
9898
const contents: any = map({
9999
$metadata: deserializeMetadata(output),
@@ -102,38 +102,6 @@ export const de_DeleteConnectionCommand = async (
102102
return contents;
103103
};
104104

105-
/**
106-
* deserializeAws_restJson1DeleteConnectionCommandError
107-
*/
108-
const de_DeleteConnectionCommandError = async (
109-
output: __HttpResponse,
110-
context: __SerdeContext
111-
): Promise<DeleteConnectionCommandOutput> => {
112-
const parsedOutput: any = {
113-
...output,
114-
body: await parseErrorBody(output.body, context),
115-
};
116-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
117-
switch (errorCode) {
118-
case "ForbiddenException":
119-
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
120-
throw await de_ForbiddenExceptionRes(parsedOutput, context);
121-
case "GoneException":
122-
case "com.amazonaws.apigatewaymanagementapi#GoneException":
123-
throw await de_GoneExceptionRes(parsedOutput, context);
124-
case "LimitExceededException":
125-
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
126-
throw await de_LimitExceededExceptionRes(parsedOutput, context);
127-
default:
128-
const parsedBody = parsedOutput.body;
129-
return throwDefaultError({
130-
output,
131-
parsedBody,
132-
errorCode,
133-
});
134-
}
135-
};
136-
137105
/**
138106
* deserializeAws_restJson1GetConnectionCommand
139107
*/
@@ -142,7 +110,7 @@ export const de_GetConnectionCommand = async (
142110
context: __SerdeContext
143111
): Promise<GetConnectionCommandOutput> => {
144112
if (output.statusCode !== 200 && output.statusCode >= 300) {
145-
return de_GetConnectionCommandError(output, context);
113+
return de_CommandError(output, context);
146114
}
147115
const contents: any = map({
148116
$metadata: deserializeMetadata(output),
@@ -157,38 +125,6 @@ export const de_GetConnectionCommand = async (
157125
return contents;
158126
};
159127

160-
/**
161-
* deserializeAws_restJson1GetConnectionCommandError
162-
*/
163-
const de_GetConnectionCommandError = async (
164-
output: __HttpResponse,
165-
context: __SerdeContext
166-
): Promise<GetConnectionCommandOutput> => {
167-
const parsedOutput: any = {
168-
...output,
169-
body: await parseErrorBody(output.body, context),
170-
};
171-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
172-
switch (errorCode) {
173-
case "ForbiddenException":
174-
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
175-
throw await de_ForbiddenExceptionRes(parsedOutput, context);
176-
case "GoneException":
177-
case "com.amazonaws.apigatewaymanagementapi#GoneException":
178-
throw await de_GoneExceptionRes(parsedOutput, context);
179-
case "LimitExceededException":
180-
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
181-
throw await de_LimitExceededExceptionRes(parsedOutput, context);
182-
default:
183-
const parsedBody = parsedOutput.body;
184-
return throwDefaultError({
185-
output,
186-
parsedBody,
187-
errorCode,
188-
});
189-
}
190-
};
191-
192128
/**
193129
* deserializeAws_restJson1PostToConnectionCommand
194130
*/
@@ -197,7 +133,7 @@ export const de_PostToConnectionCommand = async (
197133
context: __SerdeContext
198134
): Promise<PostToConnectionCommandOutput> => {
199135
if (output.statusCode !== 200 && output.statusCode >= 300) {
200-
return de_PostToConnectionCommandError(output, context);
136+
return de_CommandError(output, context);
201137
}
202138
const contents: any = map({
203139
$metadata: deserializeMetadata(output),
@@ -207,12 +143,9 @@ export const de_PostToConnectionCommand = async (
207143
};
208144

209145
/**
210-
* deserializeAws_restJson1PostToConnectionCommandError
146+
* deserialize_Aws_restJson1CommandError
211147
*/
212-
const de_PostToConnectionCommandError = async (
213-
output: __HttpResponse,
214-
context: __SerdeContext
215-
): Promise<PostToConnectionCommandOutput> => {
148+
const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): Promise<never> => {
216149
const parsedOutput: any = {
217150
...output,
218151
body: await parseErrorBody(output.body, context),
@@ -237,7 +170,7 @@ const de_PostToConnectionCommandError = async (
237170
output,
238171
parsedBody,
239172
errorCode,
240-
});
173+
}) as never;
241174
}
242175
};
243176

0 commit comments

Comments
 (0)