Default Status and Message
app.use((err, req, res, next) => {
let { status = 500, message = "ERROR OCCURRED" } = err;
res.status(status).send(message);
});
WE DIDN'T GET THE DEFAULT ERROR,BECAUSE ALREADY AN ERROR EXISTS.
HERE WE GOT THE ERROR xyz is not defined.
IF NOT WE WOULD GET THE DEFAULT ERROR.

Comments
Post a Comment