Error handling and mongoose validation errors
See original GitHub issueDuring development it is useful to see the full error reported by mongoose. E.g. you forget to assign a required parameter.
At the moment I only get ValidationError: MyModel validation failed
and a useless stack trace (all methods are part of the error handling module).
Mongoose adds details in the err.errors
property.
What would be the best way to get these error details through the error handling process (in APIErrors.js
)?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5
Top Results From Across the Web
Improve mongoose validation error handling - Stack Overflow
Whenever I enter a field against the validation rules, I get a very long error message, which is obvious. But now, I want...
Read more >Mongoose v6.8.2: Validation
Errors returned after failed validation contain an errors object whose values are ValidatorError objects. Each ValidatorError has kind , path , value ,...
Read more >Validation in Mongoose(where, how and handle errors)
Recently I am building an app to practice my Node.js and Express.js skills, which is connected with MongoDB with Mongoose. My progress is...
Read more >Handling errors in Mongoose/Express to display in React | by JB
For MongoDB, there is an internal system of error classification. MongoDB assigns different names and codes to errors that can be seen by ......
Read more >mongoose-validation-error-message-handler - npm
Mongoose Validation Error Message Handler. Latest version: 1.2.5, last published: 9 months ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a large eyesore for me, does anyone have an idea how to handle this?
@KunalKapadia do you have any suggestions how to proceed?