From 0cc3e64b8a7f6e98e51629cfde66b461fef541a3 Mon Sep 17 00:00:00 2001
From: Dan Stillman <dstillman@zotero.org>
Date: Sat, 14 Apr 2018 11:38:54 -0400
Subject: [PATCH] Restore proper incompatible DB message

Fixes #1446
---
 chrome/content/zotero/xpcom/schema.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
index bb2a31514..7be18abe0 100644
--- a/chrome/content/zotero/xpcom/schema.js
+++ b/chrome/content/zotero/xpcom/schema.js
@@ -1549,8 +1549,13 @@ Zotero.Schema = new function(){
 			return false;
 		}
 		if (dbVersion > schemaVersion) {
-			throw new Error("Zotero '" + schema + "' DB version (" + dbVersion
-				+ ") is newer than SQL file (" + schemaVersion + ")");
+			let dbClientVersion = yield Zotero.DB.valueQueryAsync(
+				"SELECT value FROM settings WHERE setting='client' AND key='lastCompatibleVersion'"
+			);
+			throw new Zotero.DB.IncompatibleVersionException(
+				`Zotero '${schema}' DB version (${dbVersion}) is newer than SQL file (${schemaVersion})`,
+				dbClientVersion
+			);
 		}
 		let sql = yield _getSchemaSQL(schema);
 		yield Zotero.DB.executeSQLFile(sql);