From 8414d97ffa2cf8f757ca90fa91c7eb7894adaf01 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 27 Feb 2019 22:15:52 +0100 Subject: [PATCH] improve logging a little bit --- src/entities/note.js | 1 + src/services/notes.js | 4 ++-- src/services/sql.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/entities/note.js b/src/entities/note.js index 32d8a792b..05ee5a0a5 100644 --- a/src/entities/note.js +++ b/src/entities/note.js @@ -685,6 +685,7 @@ class Note extends Entity { delete pojo.isContentAvailable; delete pojo.__attributeCache; delete pojo.titleCipherText; + delete pojo.noteContent; } } diff --git a/src/services/notes.js b/src/services/notes.js index 84b3cebb0..623fbc1c5 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -292,7 +292,7 @@ async function saveLinks(note, content) { async function saveNoteRevision(note) { // files and images are immutable, they can't be updated // but we don't even version titles which is probably not correct - if (note.type !== 'file' || note.type !== 'image' || await note.hasLabel('disableVersioning')) { + if (note.type === 'file' || note.type === 'image' || await note.hasLabel('disableVersioning')) { return; } @@ -311,7 +311,7 @@ async function saveNoteRevision(note) { noteId: note.noteId, // title and text should be decrypted now title: note.title, - content: note.noteContent.content, + content: await note.getContent(), type: note.type, mime: note.mime, isProtected: false, // will be fixed in the protectNoteRevisions() call diff --git a/src/services/sql.js b/src/services/sql.js index 4a84bf47f..52334e5c7 100644 --- a/src/services/sql.js +++ b/src/services/sql.js @@ -161,7 +161,7 @@ async function transactional(func) { } let ret = null; - const error = new Error(); // to capture correct stack trace in case of exception + const thisError = new Error(); // to capture correct stack trace in case of exception transactionActive = true; transactionPromise = new Promise(async (resolve, reject) => { @@ -179,7 +179,7 @@ async function transactional(func) { } catch (e) { if (transactionActive) { - log.error("Error executing transaction, executing rollback. Inner exception: " + e.stack + error.stack); + log.error("Error executing transaction, executing rollback. Inner stack: " + e.stack + "\nOutside stack: " + thisError.stack); await rollback();