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

Swallowing Error Hook #767

Closed
Mattchewone opened this issue Jan 2, 2018 · 4 comments · Fixed by #769
Closed

Swallowing Error Hook #767

Mattchewone opened this issue Jan 2, 2018 · 4 comments · Fixed by #769

Comments

@Mattchewone
Copy link
Contributor

I have a hook which will set context.result from an error hook. This works when called by an internal server call but does not work when called by an external client request.

I have created the following repo that reproduces the issue here - https://github.com/Mattchewone/feathers-buzzard-error-hooks

If you run the mocha tests in VSCode you can see that the service call sets the context.result and the response is correct, but with the client calls the context.result is set but the request still returns the error.

Not sure what context.returnHook does internally but this is false for a server call, but true for a client call.

@Mattchewone
Copy link
Contributor Author

Looks like here - https://github.com/feathersjs/express/blob/master/lib/rest/wrappers.js#L60 and https://github.com/feathersjs/socket-commons/blob/master/lib/utils.js#L119 are adding a true as a last param, which here - https://github.com/feathersjs/feathers/blob/master/lib/hooks.js#L35 is then setting the returnHook to true and is then ignoring the context.result and just returning the original error.

@daffl
Copy link
Member

daffl commented Jan 2, 2018

Indeed, definitely faulty logic there. #769 should fix it and will be published shortly.

@Mattchewone
Copy link
Contributor Author

Thanks @daffl much appreciated.

@daffl daffl closed this as completed in #769 Jan 2, 2018
@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants