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

All: Add more context to encryption errors

This commit is contained in:
Laurent Cozic
2020-03-04 16:53:45 +00:00
parent c617f43e42
commit 51ee872179
2 changed files with 13 additions and 5 deletions

View File

@ -341,7 +341,15 @@ class BaseItem extends BaseModel {
throw e;
}
const cipherText = await this.encryptionService().encryptString(serialized);
let cipherText = null;
try {
cipherText = await this.encryptionService().encryptString(serialized);
} catch (error) {
const msg = [`Could not encrypt item ${item.id}`];
if (error && error.message) msg.push(error.message);
throw new Error(msg.join(': '));
}
// List of keys that won't be encrypted - mostly foreign keys required to link items
// with each others and timestamp required for synchronisation.