-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
when failAction is log or ignored, the error is assigned to request.preResponse but not request.pre #3431
Comments
is this just a documentation thing or does this line needs fixing? should it be something like this? request.pre[pre.assign] = response instanceof Error ? response : response.source; I mean, it doesn't seems that the combination of |
I finally moved out from assigning the But I think for documentation, we definitely want to mention the error assigning behavior. |
IMO using assign should always set the response on |
@sirgallifrey So the response.source is always assigned to request.pre and the actual response is always assigned to request.preResponses? What is the benefit of request.preResponsives in the first place? Sorry if this is a silly question, I am still learning all of this. |
@squawk09 You don't have to say sorry for asking a question!
Yes, we should have the response.source on
With //prerequisite
reply({ something: 'banana' });
// later on handler
console.log(request.pre[nameIAssignedIt]); // {something:'banana'} so what about the request.preResponse? let's say you use this awesome plugin to make paginated responses and you use the option to store the pagination metadata on the response header (the actual page, number of pages, pages letf, etc) |
This comes down to having to check |
I like the solution mentioned above because it is backwards compatible.. |
@AdriVanHoudt I don't understand why you would have to look into |
@sirgallifrey misread :3 but if everyone likes @sirgallifrey's proposal a PR will get things moving the quickest I think |
I will happily make a PR with the fix and some regression tests |
@hueniverse does this mean #3457 is not needed anymore? (also not sure why not just merged that PR?) |
I tend to work from the oldest item in my queue up and sometimes I miss existing PRs... |
In the code above, the s3Error is assigned to request.preResponse but not request.pre, I wonder that why in the doc, it just states that the error is assigned but not mention where it is assigned to.
Solution:
Update the hapi doc to explicitly told that the error is assigned to request.preResponse
The text was updated successfully, but these errors were encountered: