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

request-error logged before onPostHandler or onPreResponse #2326

Closed
phated opened this issue Dec 29, 2014 · 3 comments
Closed

request-error logged before onPostHandler or onPreResponse #2326

phated opened this issue Dec 29, 2014 · 3 comments
Assignees
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Milestone

Comments

@phated
Copy link

phated commented Dec 29, 2014

I am working on a plugin that transforms application-specific errors into boom errors, e.g. Record Not Found error into boom.notFound() but I am noticing that the Record Not Found error is being logged as a request-error before the onPostHandler or onPreResponse extensions are being called to do the transformation. This causes Good to log the handler error as an internalError. Is this expected/desired? I feel like the request-errors should only happen if you don't recover from an expected error.

@bendrucker
Copy link
Contributor

This is the expected behavior but the documentation is unclear and it would be easier for me if it worked as documented.

The docs say a 'request-error' is emitted:

whenever an Internal Server Error (500) error response is sent

To me this implies that it's emitted whenever a response is actually sent to the client, but in reality it means any time reply in a handler is called with an error that matches !err.isBoom.

I did some digging a while back for a couple of plugins I wrote and the only record of the change I can find is #1277 from a year ago.

@hueniverse
Copy link
Contributor

Hmm.

@hueniverse hueniverse added the bug Bug or defect label Mar 6, 2015
@hueniverse hueniverse self-assigned this Mar 6, 2015
@hueniverse hueniverse added this to the 8.3.0 milestone Mar 6, 2015
@hueniverse hueniverse added the breaking changes Change that can breaking existing code label Mar 6, 2015
@hueniverse
Copy link
Contributor

The key here is that it should only emit once per request which is not true currently.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Projects
None yet
Development

No branches or pull requests

3 participants