mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	better logging for un/protect errors
This commit is contained in:
		| @@ -650,7 +650,7 @@ class ConsistencyChecks { | ||||
|         // root branch should always be expanded | ||||
|         sql.execute("UPDATE branches SET isExpanded = 1 WHERE branchId = 'root'"); | ||||
|  | ||||
|         if (this.unrecoveredConsistencyErrors) { | ||||
|         if (!this.unrecoveredConsistencyErrors) { | ||||
|             // we run this only if basic checks passed since this assumes basic data consistency | ||||
|  | ||||
|             this.checkTreeCycles(); | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| const NoteRevision = require('../entities/note_revision'); | ||||
| const dateUtils = require('../services/date_utils'); | ||||
| const log = require('../services/log'); | ||||
|  | ||||
| /** | ||||
|  * @param {Note} note | ||||
| @@ -9,6 +10,7 @@ const dateUtils = require('../services/date_utils'); | ||||
| function protectNoteRevisions(note) { | ||||
|     for (const revision of note.getRevisions()) { | ||||
|         if (note.isProtected !== revision.isProtected) { | ||||
|             try { | ||||
|                 const content = revision.getContent(); | ||||
|  | ||||
|                 revision.isProtected = note.isProtected; | ||||
| @@ -18,6 +20,12 @@ function protectNoteRevisions(note) { | ||||
|  | ||||
|                 revision.save(); | ||||
|             } | ||||
|             catch (e) { | ||||
|                 log.error("Could not un/protect note revision ID = " + revision.noteRevisionId); | ||||
|  | ||||
|                 throw e; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -185,6 +185,7 @@ function protectNoteRecursively(note, protect, includingSubTree, taskContext) { | ||||
| } | ||||
|  | ||||
| function protectNote(note, protect) { | ||||
|     try { | ||||
|         if (protect !== note.isProtected) { | ||||
|             const content = note.getContent(); | ||||
|  | ||||
| @@ -197,6 +198,12 @@ function protectNote(note, protect) { | ||||
|         } | ||||
|  | ||||
|         noteRevisionService.protectNoteRevisions(note); | ||||
|     } | ||||
|     catch (e) { | ||||
|         log.error("Could not un/protect note ID = " + note.noteId); | ||||
|  | ||||
|         throw e; | ||||
|     } | ||||
| } | ||||
|  | ||||
| function findImageLinks(content, foundLinks) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user