Skip to content

Commit

Permalink
feat: unified error dispatcher in protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Feb 1, 2024
1 parent fb81938 commit 8bdad06
Show file tree
Hide file tree
Showing 384 changed files with 83,783 additions and 609,784 deletions.
1,552 changes: 187 additions & 1,365 deletions clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

326 changes: 17 additions & 309 deletions clients/client-account/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

930 changes: 74 additions & 856 deletions clients/client-acm-pca/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

616 changes: 78 additions & 538 deletions clients/client-acm/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

2,855 changes: 197 additions & 2,658 deletions clients/client-alexa-for-business/src/protocols/Aws_json1_1.ts

Large diffs are not rendered by default.

1,126 changes: 73 additions & 1,053 deletions clients/client-amp/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

1,718 changes: 211 additions & 1,507 deletions clients/client-amplify/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

1,221 changes: 84 additions & 1,137 deletions clients/client-amplifybackend/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

859 changes: 62 additions & 797 deletions clients/client-amplifyuibuilder/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

5,536 changes: 501 additions & 5,035 deletions clients/client-api-gateway/src/protocols/Aws_restJson1.ts

Large diffs are not rendered by default.

Expand Up @@ -93,7 +93,7 @@ export const de_DeleteConnectionCommand = async (
context: __SerdeContext
): Promise<DeleteConnectionCommandOutput> => {
if (output.statusCode !== 204 && output.statusCode >= 300) {
return de_DeleteConnectionCommandError(output, context);
return de_CommandError(output, context) as any;
}
const contents: any = map({
$metadata: deserializeMetadata(output),
Expand All @@ -102,38 +102,6 @@ export const de_DeleteConnectionCommand = async (
return contents;
};

/**
* deserializeAws_restJson1DeleteConnectionCommandError
*/
const de_DeleteConnectionCommandError = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<DeleteConnectionCommandOutput> => {
const parsedOutput: any = {
...output,
body: await parseErrorBody(output.body, context),
};
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "ForbiddenException":
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
throw await de_ForbiddenExceptionRes(parsedOutput, context);
case "GoneException":
case "com.amazonaws.apigatewaymanagementapi#GoneException":
throw await de_GoneExceptionRes(parsedOutput, context);
case "LimitExceededException":
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
throw await de_LimitExceededExceptionRes(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
return throwDefaultError({
output,
parsedBody,
errorCode,
});
}
};

/**
* deserializeAws_restJson1GetConnectionCommand
*/
Expand All @@ -142,7 +110,7 @@ export const de_GetConnectionCommand = async (
context: __SerdeContext
): Promise<GetConnectionCommandOutput> => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_GetConnectionCommandError(output, context);
return de_CommandError(output, context) as any;
}
const contents: any = map({
$metadata: deserializeMetadata(output),
Expand All @@ -157,38 +125,6 @@ export const de_GetConnectionCommand = async (
return contents;
};

/**
* deserializeAws_restJson1GetConnectionCommandError
*/
const de_GetConnectionCommandError = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<GetConnectionCommandOutput> => {
const parsedOutput: any = {
...output,
body: await parseErrorBody(output.body, context),
};
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
switch (errorCode) {
case "ForbiddenException":
case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
throw await de_ForbiddenExceptionRes(parsedOutput, context);
case "GoneException":
case "com.amazonaws.apigatewaymanagementapi#GoneException":
throw await de_GoneExceptionRes(parsedOutput, context);
case "LimitExceededException":
case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
throw await de_LimitExceededExceptionRes(parsedOutput, context);
default:
const parsedBody = parsedOutput.body;
return throwDefaultError({
output,
parsedBody,
errorCode,
});
}
};

/**
* deserializeAws_restJson1PostToConnectionCommand
*/
Expand All @@ -197,7 +133,7 @@ export const de_PostToConnectionCommand = async (
context: __SerdeContext
): Promise<PostToConnectionCommandOutput> => {
if (output.statusCode !== 200 && output.statusCode >= 300) {
return de_PostToConnectionCommandError(output, context);
return de_CommandError(output, context) as any;
}
const contents: any = map({
$metadata: deserializeMetadata(output),
Expand All @@ -207,12 +143,9 @@ export const de_PostToConnectionCommand = async (
};

/**
* deserializeAws_restJson1PostToConnectionCommandError
* deserialize_Aws_restJson1CommandError
*/
const de_PostToConnectionCommandError = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<PostToConnectionCommandOutput> => {
const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): Promise<unknown> => {
const parsedOutput: any = {
...output,
body: await parseErrorBody(output.body, context),
Expand Down

0 comments on commit 8bdad06

Please sign in to comment.