Handling Mongoose errors in a smart way
Instead of using third-party applications or using your own code, there is another way to handle errors like Duplicate Key Error, Mongoose bad ObjectId and others.
First create a Class like this:class ErrorResponse extends Error {constructor(messa...
mohitsaud.hashnode.dev1 min read