Restore logging of unhandled errors from Bluebird (since 9aa057edee)

This commit is contained in:
Dan Stillman 2017-05-24 17:47:26 -04:00
parent 1e459287de
commit 8bc76dd2db

View file

@ -63,7 +63,26 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
this.isWin;
this.initialURL; // used by Schema to show the changelog on upgrades
// Load and configure Bluebird
this.Promise = require('resource://zotero/bluebird/bluebird.js');
this.Promise.config({
warnings: true,
longStackTraces: true,
cancellation: true
});
this.Promise.onPossiblyUnhandledRejection(function (e, promise) {
if (e.name == 'ZoteroPromiseInterrupt' || e.handledRejection) {
return;
}
Zotero.debug('Possibly unhandled rejection:\n\n'
+ (e.message
? e.message + "\n\n" + e.stack.split(/\n/)
// Filter out internal Bluebird calls
.filter(line => !line.includes('bluebird'))
.join('\n')
: e), 1);
throw e;
});
this.getActiveZoteroPane = function() {
var win = Services.wm.getMostRecentWindow("navigator:browser");