In modern NodeJS
Starting with io.js 1.4 and Node 4.0.0, you can use the process "unhandledRejection" event:
process.on("unhandledRejection", function(reason, p){ console.log("Unhandled", reason, p);
This will put an end to the raw failure problems and the difficulty of tracking them in your code.
In earlier versions of NodeJS
These events have not yet been ported to older versions of NodeJS and are unlikely to be so. You can use the promise library, which extends the promise compatibility API, for example bluebird , which will trigger the same events as in modern versions.
It is also worth noting that there are several user promise libraries that offer raw deviation detection tools and much more, such as bluebird (which also has warnings) and when .
Benjamin Gruenbaum Feb 25 '15 at 1:38 2015-02-25 01:38
source share