-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch formatError #174
Catch formatError #174
Conversation
return options.formatError(error); | ||
} catch (err) { | ||
console.error('Error in formatError function:', err); | ||
return formatError(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
People might be using formatError
to hide some information, for example maybe they don't want the error message to leak to the client. I'd suggest the best option is to return a generic "Internal server error" message instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Looks great to me, thanks! |
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
When formatError throws an error, the request nevers responds. In this PR I add try/catch to formatError and use the default one if the provided fails.
This fixes #171
TODO: