You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(node:3690) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3690) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Sugestion
Use a function to wrap the controller action that resolve the promise, in case of error, catch that and pass it to next middleware
Hi @cristianogomes, thanks for reporting this, I wasn't aware of this behavior. I'm not sure how to implement it right now, I have to think about it. Should I set a new param in the route definition ?
A controller with an
async
function that throws an error, that error doesn't reach the error handler middleware.cars-get.action.js
express.js
Sugestion
Use a function to wrap the controller action that resolve the promise, in case of error, catch that and pass it to next middleware
https://stackoverflow.com/questions/51391080/handling-errors-in-express-async-middleware
The text was updated successfully, but these errors were encountered: