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

Validation errors return status code 400 where as it should be 422 #376

Open
karthikkp opened this issue Mar 20, 2018 · 2 comments
Open

Comments

@karthikkp
Copy link

No description provided.

@Zertz
Copy link
Collaborator

Zertz commented Mar 20, 2018

Good point. I can probably roll out this change in #358

@karthikkp
Copy link
Author

karthikkp commented Mar 20, 2018

I just saw that even CastError returns 400. Basically it would be better if all mongoose related errors are put in 422 and if a field name is spelt wrong, or if the "id" specified is wrong a 400 will be better. So on the front end, all 422 errors, we can display the error message that comes with the response(examples - email already exists, passwords don't match,validation errors), whereas for 400 "the fault is with the client that sends the request" and we can display a generic error message like "something went wrong". So 400 errors need to be fixed on the frontend and 422 errors don't need fixing.

@Zertz Zertz removed the v5.0 label Jun 10, 2018
@Zertz Zertz removed their assignment Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants