Skip to content

Instantly share code, notes, and snippets.

@ThomasAribart
Last active May 10, 2020 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasAribart/b34d5c9a81646670f23b8d01fdfdc342 to your computer and use it in GitHub Desktop.
Save ThomasAribart/b34d5c9a81646670f23b8d01fdfdc342 to your computer and use it in GitHub Desktop.
const formatErrorForApiGateway = ({ error }) => {
const { statusCode, key, message } =
error instanceof CustomError
? error
: new InternalServerError({ message: error.message });
throw `[${statusCode}] [${key}] ${message}`;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment