Download node_modules/@aws-sdk/smithy-client/dist-es/default-error-handler.js from sweet2004/bot: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/smithy-client/dist-es/default-error-handler.js
- Command line
-
hf download hf://spaces/sweet2004/bot/node_modules/@aws-sdk/smithy-client/dist-es/default-error-handler.js
-
curl -L -o default-error-handler.js https://huggingface.co/spaces/sweet2004/bot/resolve/main/node_modules/%40aws-sdk/smithy-client/dist-es/default-error-handler.js
1.06 kB
| import { decorateServiceException } from "./exceptions"; | |
| export const throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => { | |
| const $metadata = deserializeMetadata(output); | |
| const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined; | |
| const response = new exceptionCtor({ | |
| name: parsedBody?.code || parsedBody?.Code || errorCode || statusCode || "UnknownError", | |
| $fault: "client", | |
| $metadata, | |
| }); | |
| throw decorateServiceException(response, parsedBody); | |
| }; | |
| export const withBaseException = (ExceptionCtor) => { | |
| return ({ output, parsedBody, errorCode }) => { | |
| throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); | |
| }; | |
| }; | |
| const deserializeMetadata = (output) => ({ | |
| httpStatusCode: output.statusCode, | |
| requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"], | |
| extendedRequestId: output.headers["x-amz-id-2"], | |
| cfId: output.headers["x-amz-cf-id"], | |
| }); | |