diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 872a3f598..70ea26c5f 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1446,14 +1446,15 @@ Zotero.Utilities = { let msg = (obj.message ? ('' + obj.message).replace(/^/gm, level_padding).trim() : ''); if (obj.stack) { let stack = obj.stack.trim().replace(/^(?=.)/gm, level_padding); + stack = Zotero.Utilities.Internal.filterStack(stack); msg += '\n\n'; // At least with Zotero.HTTP.UnexpectedStatusException, the stack contains "Error:" // and the message in addition to the trace. I'm not sure what's causing that // (Bluebird?), but fix it here. - if (obj.stack.startsWith('Error:')) { - msg += obj.stack.replace('Error: ' + obj.message + '\n', ''); + if (stack.startsWith('Error:')) { + msg += stack.replace('Error: ' + obj.message + '\n', ''); } else { msg += stack; diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index e8b9896e9..df74d48da 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -1123,6 +1123,13 @@ Zotero.Utilities.Internal = { }, + filterStack: function (stack) { + return stack.split(/\n/) + .filter(line => !line.includes('resource://zotero/bluebird')) + .join('\n'); + }, + + quitZotero: function(restart=false) { Zotero.debug("Zotero.Utilities.Internal.quitZotero() is deprecated -- use quit()"); this.quit(restart); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 3b695bdce..ea74f4966 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -768,8 +768,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); throw e; } - Zotero.startupError = Zotero.getString('startupError.databaseUpgradeError') + "\n\n" - + (e.stack || e); + let stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null; + Zotero.startupError = Zotero.getString('startupError.databaseUpgradeError') + + "\n\n" + + (stack || e); throw e; } @@ -899,7 +901,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); ); } else { - Zotero.startupError = Zotero.getString('startupError') + "\n\n" + (e.stack || e); + let stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null; + Zotero.startupError = Zotero.getString('startupError') + "\n\n" + (stack || e); } Zotero.debug(e.toString(), 1);