Remove pointless Bluebird lines from various stack traces
This commit is contained in:
parent
7b0ed6da81
commit
34e23937a1
3 changed files with 16 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue