Skip to content

Build your personal knowledge base with Trilium Notes

add ignoreMissing flag to becca's getNotes()

zadam7261ab69bc09
diff --git a/package.json b/package.json
index e215d67379..a0fb97420e 100644
--- a/package.json
+++ b/package.json
@@ -90,7 +90,7 @@
"jsdoc": "3.6.7",
"lorem-ipsum": "2.0.3",
"rcedit": "3.0.1",
- "webpack": "5.45.1",
+ "webpack": "5.46.0",
"webpack-cli": "4.7.2"
},
"optionalDependencies": {
diff --git a/src/becca/becca.js b/src/becca/becca.js
index eed48199c6..d6f32cb3ab 100644
--- a/src/becca/becca.js
+++ b/src/becca/becca.js
@@ -55,13 +55,17 @@ class Becca {
return this.notes[noteId];
}
- getNotes(noteIds) {
+ getNotes(noteIds, ignoreMissing = false) {
const filteredNotes = [];
for (const noteId of noteIds) {
const note = this.notes[noteId];
if (!note) {
+ if (ignoreMissing) {
+ continue;
+ }
+
throw new Error(`Note '${noteId}' was not found in becca.`);
}
diff --git a/src/routes/api/note_revisions.js b/src/routes/api/note_revisions.js
index 8d23dcf1df..47459dd43a 100644
--- a/src/routes/api/note_revisions.js
+++ b/src/routes/api/note_revisions.js
@@ -120,7 +120,7 @@ function getEditedNotesOnDate(req) {
ORDER BY isDeleted
LIMIT 50`, {date: req.params.date + '%'});
- const notes = becca.getNotes(noteIds);
+ const notes = becca.getNotes(noteIds, true);
for (const note of notes) {
const notePath = note.isDeleted ? null : beccaService.getNotePath(note.noteId);