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

output validation error pass source along #3194

Closed
catalint opened this issue Jun 7, 2016 · 5 comments
Closed

output validation error pass source along #3194

catalint opened this issue Jun 7, 2016 · 5 comments
Assignees
Labels
Milestone

Comments

@catalint
Copy link

@catalint catalint commented Jun 7, 2016

When request response validation fails , when creating the Boom object, also pass along the original error object ?

https://github.com/hapijs/hapi/blob/master/lib/validation.js#L201
right now it's

return next(Boom.badImplementation(err.message));

what do you say about

return next(Boom.badImplementation(err.message, err));

or

return next(Boom.badImplementation(err.message, value));

Use case :

I'm trying to log these errors in sentry and I'm only getting the message that it failed validation at some key, if I add the err or value in data, I can see the context and debug faster.

What are your thoughts on this ? I would do a PR if you are ok.

@AdriVanHoudt
Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jun 7, 2016

Why not do next(Boom.badImplementation(err)) and you can log/parse/send to sentry whatever you want on server.on('response', ...)

@catalint
Copy link
Author

@catalint catalint commented Jun 7, 2016

the way Boom is designed, it wants a message in the first param, not an error object , the second param is reserved for extra data

@AdriVanHoudt
Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jun 7, 2016

ah yes sorry missed that, you can still handle the error on server.on('response', ...) no?

@nlf nlf added the request label Jun 10, 2016
@hueniverse
Copy link
Contributor

@hueniverse hueniverse commented Aug 23, 2016

Use the new failAction feature with a function.

@hueniverse hueniverse closed this Aug 23, 2016
@hueniverse hueniverse self-assigned this Aug 23, 2016
@hueniverse hueniverse added this to the 15.0.0 milestone Aug 23, 2016
@Marsup Marsup added feature and removed request labels Sep 20, 2019
@lock
Copy link

@lock lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants