InversifyJS: Restify and Express utils hang if there's a thrown error in the controller
If an error is thrown inside the controller, the route is never resolved. This results in the route never being resolved.
Expected Behavior
I’d expect for the error to resolved as an error up the callback chain
Current Behavior
The route is never resolved
Possible Solution
Wrap in a try/catch and resolve the callback/
Steps to Reproduce (for bugs)
- Create controller
- Add
throw new Error('some error')
as the first line - Hit the endpoint in your browser
Context
This is a problem in production in case something throws an error and it’ll cause a bottleneck.
Your Environment
- Version used: 2.1.2 (restify) 2.0.2 (express)
- Environment name and version: Node 6
- Operating System and version: OSX
Stack trace
None
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 29 (18 by maintainers)
@lholznagel I don’t think we need to do that as Restify and Express already handle that as they do a
cb('err')
orPromise.reject('err')
.PR will be incoming - I’m on a train at the moment so WiFi keeps cutting out
ah okay.
We could make use of
setErrorConfig(errorConfig)
frominversify-express-utils
and use that when a error happens