From f428cc26a202b18bb4234c8997eb3d04aa006587 Mon Sep 17 00:00:00 2001 From: mic704b Date: Tue, 4 Feb 2020 08:40:48 +1100 Subject: [PATCH] All: More info for "unknown profile version" error message (#2361) * Add version info to profile error message. Add profile version to desktop About Box. * Add profile error to log. * Use shim to retrive version number. * Refactor to use registry instead of BaseModel to get database. * Remove call to logger. * Improve code readability. --- ElectronClient/app/app.js | 1 + ReactNativeClient/lib/joplin-database.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 16698fcbeb..07b5a1919d 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -629,6 +629,7 @@ class Application extends BaseApplication { '', _('Client ID: %s', Setting.value('clientId')), _('Sync Version: %s', Setting.value('syncVersion')), + _('Profile Version: %s', reg.db().version()), ]; if (gitInfo) { message.push(`\n${gitInfo}`); diff --git a/ReactNativeClient/lib/joplin-database.js b/ReactNativeClient/lib/joplin-database.js index 8b3ec76697..06cb2c6aae 100644 --- a/ReactNativeClient/lib/joplin-database.js +++ b/ReactNativeClient/lib/joplin-database.js @@ -2,6 +2,7 @@ const { promiseChain } = require('lib/promise-utils.js'); const { Database } = require('lib/database.js'); const { sprintf } = require('sprintf-js'); const Resource = require('lib/models/Resource'); +const { shim } = require('lib/shim.js'); const structureSql = ` CREATE TABLE folders ( @@ -313,7 +314,13 @@ class JoplinDatabase extends Database { // currentVersionIndex < 0 if for the case where an old version of Joplin used with a newer // version of the database, so that migration is not run in this case. - if (currentVersionIndex < 0) throw new Error('Unknown profile version. Most likely this is an old version of Joplin, while the profile was created by a newer version. Please upgrade Joplin at https://joplinapp.org and try again.'); + if (currentVersionIndex < 0) { + throw new Error( + 'Unknown profile version. Most likely this is an old version of Joplin, while the profile was created by a newer version. Please upgrade Joplin at https://joplinapp.org and try again.\n' + + `Joplin version: ${shim.appVersion()}\n` + + `Profile version: ${fromVersion}\n` + + `Expected version: ${existingDatabaseVersions[existingDatabaseVersions.length-1]}`); + } if (currentVersionIndex == existingDatabaseVersions.length - 1) return fromVersion;