node.js - Log all reject promises in Q -


is there way configure q log or call specific function on rejected promises (like interceptor)?

many exceptions being swallowed in application, , put error handling in promises logging purposes duplicated work do.

thanks!

q supports - of 1.3.0 q offers standard unhandled rejection hooks:

process.on("unhandledrejection", function(reason, p) {   console.log("unhandled rejection detected ", reason, p); }); 

you can log caught errors .done q.onerror:

q.onerror = function(error){     // errors here , not thrown in `done` chains. }; 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -