mirror of
https://github.com/zotero/zotero.git
synced 2026-10-09 03:18:01 +00:00
Include the error message in startup error dialogs
SpiderMonkey stacks contain only frames, so the startup error messages that showed just the stack didn't say what had failed.9b3d7a32e3added the message to one of the three, where a ternary-precedence bug then dropped the surrounding text instead. Format all three the same way. (cherry picked from commit26988646bf)
This commit is contained in:
parent
9244cbe50a
commit
6d6510fec5
1 changed files with 17 additions and 5 deletions
|
|
@ -672,10 +672,9 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
// Report the error unless corruption recovery has already started a quit
|
||||
// or restart
|
||||
if (!Zotero.skipLoading) {
|
||||
let stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null;
|
||||
Zotero.startupError = Zotero.getString('startupError.databaseUpgradeError')
|
||||
+ "\n\n"
|
||||
+ (stack || e);
|
||||
+ _formatStartupError(e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
|
@ -856,7 +855,7 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
if (!Zotero.startupError && !Zotero.skipLoading) {
|
||||
Zotero.startupError = Zotero.getString('startupError', Zotero.appName) + "\n\n"
|
||||
+ Zotero.getString('db.integrityCheck.reportInForums') + "\n\n"
|
||||
+ e.message ? (e.message + "\n\n" + e.stack) : e;
|
||||
+ _formatStartupError(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -914,10 +913,9 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
Zotero.startupError = Zotero.getString('startupError.databaseInUse');
|
||||
}
|
||||
else {
|
||||
let stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null;
|
||||
Zotero.startupError = Zotero.getString('startupError', Zotero.appName) + "\n\n"
|
||||
+ Zotero.getString('db.integrityCheck.reportInForums') + "\n\n"
|
||||
+ (stack || e);
|
||||
+ _formatStartupError(e);
|
||||
}
|
||||
|
||||
Zotero.debug(e.toString(), 1);
|
||||
|
|
@ -930,6 +928,20 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* Format an error for a startup error message
|
||||
*
|
||||
* SpiderMonkey stacks contain only frames, so the message has to be included with them.
|
||||
*
|
||||
* @param {Error|*} e
|
||||
* @return {String|*}
|
||||
*/
|
||||
function _formatStartupError(e) {
|
||||
var stack = e.stack ? Zotero.Utilities.Internal.filterStack(e.stack) : null;
|
||||
return [e.message, stack].filter(x => x).join("\n\n") || e;
|
||||
}
|
||||
|
||||
|
||||
function _checkDataDirAccessError(e) {
|
||||
if (e.name != 'NS_ERROR_FILE_ACCESS_DENIED' && !e.message.includes('2152857621')) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue