1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-02-01 19:15:01 +02:00

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.
This commit is contained in:
mic704b 2020-02-04 08:40:48 +11:00 committed by GitHub
parent cf6c141e57
commit f428cc26a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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}`);

View File

@ -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;