-
-
Notifications
You must be signed in to change notification settings - Fork 11
Unhandled promises exception handler #1
Comments
Yes, we can add this. But with a bold warning saying that all |
Laravel solves this with a global exception handler as last resort. Of course users can wrap in try/catch if they wish, but I hope this handler would keep the process from exiting in production and log the error (or display it?), and in dev mode just output a stack trace like the sample above. What do you think? |
Yeah so in Node land, we prefer the process to crash for uncaught exceptions. So here are 2 things.
The first one is something blowed somewhere and no one handled it. So we want the process to crash, so that there are no weird memory leaks. The unhandled rejections is more of, dude you are writing async code and expecting that it will never reject, but that is wrong. We should add a listener for it, but only for educating the user that there is something wrong and but not for rescuing them from a bad situation. |
That would work for me. Like we run it in dev mode and each time it fires it shows a big warning educating developers about what to do. To be fair, at dev time, most of my exceptions have to do with buggy code, not actually legitimate runtime rejections :)
|
Yes, will do this |
Fine work!! |
From @benallfree on October 28, 2017 23:8
Right now we don't output stack traces for unhandled promises.
nodejs/node#9523 (comment)
process.on('unhandledRejection', r => console.log(r))
Fixes it.
Is this something that is worth adding to the framework when in dev mode?
Copied from original issue: adonisjs/core#688
The text was updated successfully, but these errors were encountered: