Skip to content

Instantly share code, notes, and snippets.

functions:
myLambda:
...
integration: lambda
response: ${file(./response.yml)}
const formatErrorForApiGateway = ({ parsers } = { parsers: [] }) =>
({ error }) => {
const { statusCode, key, message } = parseError(error, parsers);
throw `[${statusCode}] [${key}] ${message}`;
};
...
const handler = middy(businessLogic)
.onError(formatErrorForApiGateway({ parsers: [parseAxiosError] });