Last active
July 7, 2020 01:04
-
-
Save 5t33/b6ae49f265c15c8e5af20cad6fbfc073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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