Skip to content

Commit 9223e6b

Browse files
committed
feat: unified error dispatcher in protocols
1 parent 04df491 commit 9223e6b

File tree

227 files changed

+40947
-316399
lines changed

Some content is hidden

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

227 files changed

+40947
-316399
lines changed

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

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

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

Lines changed: 17 additions & 309 deletions
Large diffs are not rendered by default.

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

Lines changed: 73 additions & 1053 deletions
Large diffs are not rendered by default.

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

Lines changed: 211 additions & 1507 deletions
Large diffs are not rendered by default.

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

Lines changed: 84 additions & 1137 deletions
Large diffs are not rendered by default.

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

Lines changed: 62 additions & 797 deletions
Large diffs are not rendered by default.

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

Lines changed: 501 additions & 5035 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 72 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) as any;
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) as any;
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) as any;
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<unknown> => {
216149
const parsedOutput: any = {
217150
...output,
218151
body: await parseErrorBody(output.body, context),

0 commit comments

Comments
 (0)