From 8bc76dd2dbc2282818028e859f76fe7cb5758505 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 24 May 2017 17:47:26 -0400 Subject: [PATCH] Restore logging of unhandled errors from Bluebird (since 9aa057edee) --- chrome/content/zotero/xpcom/zotero.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index a39be20c9..02354b3a9 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -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");