Last active
July 7, 2020 04:13
-
-
Save 5t33/52e74a4d634d4610e49eae731d4f71b7 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.reject(response) | |
} else { | |
logger.error("Internal Server Error: ", error); | |
const response = formatApiError(new ApiError(500, "Internal Server Error")); | |
return Promise.reject(response); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment