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

Mongoose ValidationError messages do not surface #116

Closed
jonjamz opened this issue Aug 24, 2016 · 6 comments
Closed

Mongoose ValidationError messages do not surface #116

jonjamz opened this issue Aug 24, 2016 · 6 comments

Comments

@jonjamz
Copy link

jonjamz commented Aug 24, 2016

I tried creating a user with an invalid field and the service gave me a FeathersError:

BadRequest: user validation failed

However, creating that user with the same invalid data using the Mongoose model directly yielded much more useful error messaging:

'avatar.files.img': { /avatar-placeholder.gif is not a valid URL! ...

Is there something specific that I can do to get these validation messages without having to manually use the model each time I encounter such an error?

@daffl
Copy link
Member

daffl commented Aug 25, 2016

You are not getting any additional information in the errors or data property?

@kaiquewdev
Copy link

@jonjamz Do you have some samples about this specific issue who you can share with us to help you?

@ekryski
Copy link
Member

ekryski commented Oct 22, 2016

@jonjamz what did you want to see? Are you referring to having more information in the server logs? The error details are there in the error object and get sent back to the client over JSON but we would likely need to update the feathers error handler to just spit out the attributes.

Either that or register your own error handler.

@jonjamz
Copy link
Author

jonjamz commented Oct 22, 2016

@ekryski yes it sounds like an update to the feathers error handler would do the trick. I would like to see whatever messaging is in the original error logged also on the server, as if it was never wrapped in anything else. This would make for a much nicer developer experience I think.

@jonjamz
Copy link
Author

jonjamz commented Oct 22, 2016

@daffl I didn't check those properties at the time, but looking at the error handler code for this library it seems like all that information should be there in the error object. It would just be nice to see it on the server without any extra work.

@ekryski
Copy link
Member

ekryski commented Aug 31, 2017

I think this is resolved. This is a pretty old issue and we have been seeing validation errors in production apps for quite a while.

Closing. Please re-open if this is still relevant.

@ekryski ekryski closed this as completed Aug 31, 2017
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