Question
How can you pass an error to the error handler middleware?
Asked by: USER9291
58 Viewed
58 Answers
Responsive Ad After Question
Answer (58)
You pass an error to the error handler middleware by calling the `next()` function with an error object as its argument. For example, inside a route handler: `if (error) { return next(error); }`.