Skip to content

Conversation

@SreejithNS
Copy link
Owner

Previously the Error wasn't handled completely and was passed on. That ended up throwing the entire Error as html to response. Which exposed the source files and line numbers.

Previously the Error wasn't handled completely and was passed on. That ended up throwing the entire Error as html to response. Which exposed the source files and line numbers.
@SreejithNS SreejithNS merged commit 5b0c467 into master Oct 6, 2020
@SreejithNS SreejithNS deleted the SreejithNS-jwt-error-handled branch October 6, 2020 16:36
app.use((err, req, res) => {
if(err.name == "UnauthorizedError"){
return apiResponse.unauthorizedResponse(res, err.message);
apiResponse.unauthorizedResponse(res, err.message);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A return will again pass the error to next middleware, if nothing handles then it will be thrown as uncaught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant