Skip to content

Instantly share code, notes, and snippets.

@5t33
Last active July 7, 2020 01:04
Show Gist options
  • Save 5t33/b6ae49f265c15c8e5af20cad6fbfc073 to your computer and use it in GitHub Desktop.
Save 5t33/b6ae49f265c15c8e5af20cad6fbfc073 to your computer and use it in GitHub Desktop.
module.exports.handleError = (logger, error ) => {
if (error instanceof ApiError) {
const response = formatApiError(error);
return Promise.resolve(response)
} else {
logger.error("Internal Server Error: ", error);
const response = formatApiError(new ApiError(500, "Internal Server Error"));
return Promise.reject(error);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment