Skip to content
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

Error events not handled #8

Open
iantocristian opened this issue Jan 31, 2019 · 3 comments
Open

Error events not handled #8

iantocristian opened this issue Jan 31, 2019 · 3 comments

Comments

@iantocristian
Copy link

Was there any particular reason for not capturing exceptions?

@jsynowiec
Copy link
Owner

You can capture errors by setting captureUncaught: true in the config. It then sets up a global listener for uncaught exceptions.

AFAIR this module was only meant to be used as a write stream for hapi server events so effectively logging to Sentry instead of stdout.

@iantocristian
Copy link
Author

iantocristian commented Feb 15, 2019

This is the thing, hapi server events do include errors. server logs could be logging errors and there are also the request errors (the error event). Is there a reason for not sending these to Sentry as exceptions allowing it to properly capture the error details? Request errors are not uncaught errors, these would have to be sent explicitly to the Sentry client. Writing a direct Sentry integration is also possible, but via good it's easier, also makes sense when you are logging errors through hapi logs already.

I guess with server.logging one has the choice of whether to log actual errors or just strings (so you can control what goes into the stream), but error events always send errors. The error events in particular are not handled well currently in this module, as data is empty and it will just send undefined to Sentry. You can ofc filter to only get server log events in your reporter, but I don't see any good reason for not handling errors.

@iantocristian
Copy link
Author

btw good explicitly supports logging errors via server.log now, so if you pass an error object to server.log into will go into the error field not into the data field.

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

No branches or pull requests

2 participants