mirror of
https://github.com/zotero/zotero.git
synced 2026-09-16 23:41:08 +00:00
log stringified exceptions in debug output
If an exception (e.g. Zotero.Exception.UnloadedDataException) is thrown without the debugger enabled (meaning, by most users), it is logged as a non-descriptive [JavaScript Error: "uncaught exception: Object"]. This stringifies the exception object and puts the string into the message, so that the actual error and the stacktrace are not lost.
This commit is contained in:
parent
b3a3757716
commit
d4155488e1
1 changed files with 6 additions and 1 deletions
|
|
@ -1373,7 +1373,12 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
}
|
||||
|
||||
if (asStrings) {
|
||||
errors.push(altMessage || msg.message)
|
||||
let message = altMessage || msg.message;
|
||||
// Stringify exceptions object instead of just returning "Object"
|
||||
if (message.includes('uncaught exception: Object') && typeof msg.exception == "object") {
|
||||
message = "[JavaScript Error:" + JSON.stringify(msg.exception);
|
||||
}
|
||||
errors.push(message);
|
||||
}
|
||||
else {
|
||||
errors.push(msg);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue