In express app, I researched that we can handle error using something like this:
// app.js
app.use(function (error, req, res, next) {
// Handle errors
});
my questions are:
- am I right that this function will be called only if there is an error? I could not get this function to call if there is no error. Am I missing anything?
- is there any case that this function will get called even there is no error?
Thanks