-
Notifications
You must be signed in to change notification settings - Fork 74
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
Comments
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. |
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? |
@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. |
@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 :) |
@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. |
https://github.com/feathersjs/feathers-sequelize/blob/master/src/index.js#L61
https://github.com/feathersjs/feathers-sequelize/blob/master/src/index.js#L114
The text was updated successfully, but these errors were encountered: