MCPcopy Index your code
hub / github.com/serverless/serverless / buildV3ProviderError

Function buildV3ProviderError

packages/serverless/lib/aws/v3/error-utils.js:3–29  ·  view source on GitHub ↗
(err)

Source from the content-addressed store, hash-verified

1import ServerlessError from '../../serverless-error.js'
2
3export const buildV3ProviderError = (err) => {
4 const statusCode = err?.$metadata?.httpStatusCode
5 const requestId = err?.$metadata?.requestId
6 const code = err?.name || err?.code || 'Error'
7 const retryableNames = new Set([
8 'Throttling',
9 'ThrottlingException',
10 'TooManyRequestsException',
11 'RequestTimeout',
12 'NetworkingError',
13 'TimeoutError',
14 'InternalError',
15 'ServiceUnavailable',
16 ])
17 let retryable =
18 Boolean(err?.$retryable?.throttling) ||
19 retryableNames.has(code) ||
20 (typeof statusCode === 'number' &&
21 (statusCode >= 500 || statusCode === 429))
22 return Object.assign({}, err, {
23 statusCode,
24 requestId,
25 code,
26 retryable,
27 original: err,
28 })
29}
30
31const normalizerPattern = /(?<!^)([A-Z])/g
32export const normalizeErrorCodePostfix = (name) =>

Callers 1

handleV3ErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…