-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
customErrorHandler should not obscure original error #26
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
Preserving the stacktrace seems to be possible without that getting exposed in the response, but how would you go about making the original message available in the hook and at the same time have the reply contain the modified error message? |
The Here the hook will never be called:
The use case is clear, but I didn't understand your idea to solve |
@Eomm the 'onError' hook will be called if you reply with an error in the error handled. From the docs:
|
Ok, I forget about it 👍
in the customErrorHandler there are 2 approaches
Not sure which one is the best, we should try and check the output |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
#109 has (kind of) resolved this by removing the customErrorHandler? |
Yes, I would close it since it is no longer valid. |
🚀 Feature Proposal
When using the onError hook to log errors to monitoring services, it would be great to have access to the original error.
However this is not currently possible with fastify-sensible customErrorHandler, because it creates a new Error with a new stacktrace for unhandled 500 errors.
Motivation
Being able to log the original error without having to disable fastify-sensible customErrorHandler
Example
The text was updated successfully, but these errors were encountered: