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
Milestone

Comments

@phated
Copy link

@phated 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

@bendrucker bendrucker commented Dec 30, 2014

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

@hueniverse hueniverse commented Jan 4, 2015

Hmm.

@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Mar 6, 2015

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

@hueniverse hueniverse closed this in 2187fa3 Mar 6, 2015
@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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants