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

Service methods should reject with feathers error instance rather throwing in-place #23

Closed
rafalszemraj opened this issue Mar 5, 2016 · 5 comments

Comments

@daffl
Copy link
Member

daffl commented Mar 6, 2016

Is there a specific reason for changing this? It should be fine according to the promise spec and I'm fairly sure the tests are covering that those errors are being propagated.

@rafalszemraj
Copy link
Contributor Author

Maybe I missed something in here (just started with feathers) but what I'm trying to do is to expose my user sequelize service via rest api. I'd expect the have error to be returned as json (same way as I have my results) but instead I get whole stack trace displayed as plain text. Noticed (and checked) that when returning error it gives my nice json output I can consume in my UI. Is there something I need to do to prepare my feather app to be able to catch these exceptions?

@ekryski
Copy link
Member

ekryski commented Mar 6, 2016

@rafalszemraj If you are using the Feathers error handler in your app (which is included in a generated app) then errors will be returned as JSON. My guess is you don't have the error handler included and it is instead using the default error handler that comes with Express.

See http://docs.feathersjs.com/middleware/error-handling.html for how to configure the feathers error handler.

@rafalszemraj
Copy link
Contributor Author

@ekryski I'm using feathers error handler, but (and this is what I missed) I did not added it as a last middleware to my app. After moving it to end of the mw chain it's working as expected. Closing this one, thanks for help :)

@ekryski
Copy link
Member

ekryski commented Mar 6, 2016

@rafalszemraj no problem. I added a comment in the docs about this because I think it's an easy mistake to make. It happens all the time with Express.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@daffl @rafalszemraj @ekryski and others