Remove pointless Bluebird lines from various stack traces

This commit is contained in:
Dan Stillman 2017-08-05 01:09:57 +02:00
parent 7b0ed6da81
commit 34e23937a1
3 changed files with 16 additions and 5 deletions

View file

@ -1446,14 +1446,15 @@ Zotero.Utilities = {
let msg = (obj.message ? ('' + obj.message).replace(/^/gm, level_padding).trim() : ''); let msg = (obj.message ? ('' + obj.message).replace(/^/gm, level_padding).trim() : '');
if (obj.stack) { if (obj.stack) {
let stack = obj.stack.trim().replace(/^(?=.)/gm, level_padding); let stack = obj.stack.trim().replace(/^(?=.)/gm, level_padding);
stack = Zotero.Utilities.Internal.filterStack(stack);
msg += '\n\n'; msg += '\n\n';
// At least with Zotero.HTTP.UnexpectedStatusException, the stack contains "Error:" // 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 // and the message in addition to the trace. I'm not sure what's causing that
// (Bluebird?), but fix it here. // (Bluebird?), but fix it here.
if (obj.stack.startsWith('Error:')) { if (stack.startsWith('Error:')) {
msg += obj.stack.replace('Error: ' + obj.message + '\n', ''); msg += stack.replace('Error: ' + obj.message + '\n', '');
} }
else { else {
msg += stack; msg += stack;

View file

@ -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) { quitZotero: function(restart=false) {
Zotero.debug("Zotero.Utilities.Internal.quitZotero() is deprecated -- use quit()"); Zotero.debug("Zotero.Utilities.Internal.quitZotero() is deprecated -- use quit()");
this.quit(restart); this.quit(restart);

View file

@ -768,8 +768,10 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
throw e; throw e;
} }
Zotero.startupError = Zotero.getString('startupError.databaseUpgradeError') + "\n\n" let stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null;
+ (e.stack || e); Zotero.startupError = Zotero.getString('startupError.databaseUpgradeError')
+ "\n\n"
+ (stack || e);
throw e; throw e;
} }
@ -899,7 +901,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
); );
} }
else { 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); Zotero.debug(e.toString(), 1);