I have a route
app.get("/some/url/", function(req, res){ res.sendStatus(404) })
I am trying to handle or catch this 404 in express error handling middleware and it is not working
app.use(function(err, req, res, next){do something here})
Any help how do i capture the error thrown by route in the middleware.
res.sendStatus(404); next(new Error('404 Not found'));.