Could a router have a specific error handler ?
I understand that the (err, req, res, next) signature is not supported, however, that feature is really missing. For example, my app have three separate routers with totally different behaviors:
- generates html pages
- the api
- static files
and each router needs to deal with errors very differently.
Hello, as you may have read from previous issues and documentation, the hyper-express middleware system at the moment is very different from Express.js in both its operation and internal logic.
- Middlewares and Routes are different without sharing the same signature.
- Middlewares execute in a hierarchical manner where order is GLOBAL -> LOCAL -> ROUTE_SPECIFIC
Unfortunately, we only support a global error handler at the moment. I do think that a router specific error handler should be possible in theory since it would be an additive change rather than a breaking one.
Do you have reference on the signature, behavior and expectation of this feature?
A router-specific error handler would just have to get the error and be able to res.send() something.
Also while you are considering this, I think currently hyper-express doesn't catch errors when calling a middleware with (req, res, next) signature ?
I am currently working on a router specific error handler. Would it be possible to be assigned to this?