Closed sbarry157 closed 4 years ago
I think you're right, it shouldn't rethrow it.
@sbarry157 released as 3.0.0, I also bumped the supported node version range.
@jeffijoe excellent. Thanks for the quick resolution :)
No problem! I'd suggest using Koa though. :)
We would like to start using awilix-express moving forward, but promise rejections are not handled as we expected. Using express-promise-router, our pattern is this:
all routes return promises When an error happens, throw immediately. register an error handler (app.use) to inspect the error and return the appropriate response.
I noticed #15 relates to this issue.
But in looking at the code, I see that the error is re-thrown after calling
next
. I think this is causing the issue.Looking at
express-promise-router
, they don't re-throw in this situation:Maybe I'm not using the library correctly?