I\'m writing an API for my system, that\'s sending an XHR to the server and returns a promise that should be handled by the caller - so far so good.
For each API cal
With bluebird Promises, you can call
Promise.onPossiblyUnhandledRejection(function(error){
// Handle error here
console.error(error);
});
With iojs you have the process.on('unhandledRejection')
handler as specified here. (Also worth reading this and this
As far as I know, neither native Promises anywhere else nor Q Promises offer this functionality.