commit 8bc76dd2dbc2282818028e859f76fe7cb5758505 parent 1e459287deb3eee8841aad7c6f4775782cbc3e80 Author: Dan Stillman <dstillman@zotero.org> Date: Wed, 24 May 2017 17:47:26 -0400 Restore logging of unhandled errors from Bluebird (since 9aa057edee) Diffstat:
| M | chrome/content/zotero/xpcom/zotero.js | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git 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");