commit e1c1803ce2307e1a8da88a6856cad75303a07574
parent aab21f68ad8e15556ea6bff050919c8445ffe500
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 30 Mar 2015 14:45:53 -0400
Add DB version info to newer-DB-version error
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -1899,7 +1899,8 @@ Zotero.Schema = new function(){
return false;
}
else if (fromVersion > toVersion) {
- throw("Zotero user data DB version is newer than SQL file");
+ throw new Error("Zotero user data DB version is newer than SQL file "
+ + "(" + toVersion + " < " + fromVersion + ")");
}
Zotero.debug('Updating user data tables from version ' + fromVersion + ' to ' + toVersion);
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -608,13 +608,13 @@ Components.utils.import("resource://gre/modules/Services.jsm");
var updated = Zotero.Schema.updateSchema();
}
catch (e) {
- if (typeof e == 'string' && e.match('newer than SQL file')) {
- var kbURL = "http://zotero.org/support/kb/newer_db_version";
- var msg = Zotero.localeJoin([
- Zotero.getString('startupError.zoteroVersionIsOlder'),
- Zotero.getString('startupError.zoteroVersionIsOlder.upgrade')
- ]) + "\n\n"
- + Zotero.getString('startupError.zoteroVersionIsOlder.current', Zotero.version) + "\n\n"
+ if (e.toString().match('newer than SQL file')) {
+ let versions = e.toString().match(/\((\d+) < \d+\)/);
+ let kbURL = "https://www.zotero.org/support/kb/newer_db_version";
+ let msg = Zotero.getString('startupError.zoteroVersionIsOlder') + " "
+ + Zotero.getString('startupError.zoteroVersionIsOlder.upgrade') + "\n\n"
+ + Zotero.getString('startupError.zoteroVersionIsOlder.current', Zotero.version) + "\n"
+ + (versions ? "DB: " + versions[1] + "\n\n" : "\n")
+ Zotero.getString('general.seeForMoreInformation', kbURL);
Zotero.startupError = msg;
_startupErrorHandler = function() {