commit 34e23937a158344a4dcb9ca3d89a580087226d89
parent 7b0ed6da8167873a8f67a5d36fad30be99e6539f
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 5 Aug 2017 01:09:57 +0200
Remove pointless Bluebird lines from various stack traces
Diffstat:
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git 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
@@ -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
@@ -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);