add ignoreMissing flag to becca's getNotes()

This commit is contained in:
zadam
2021-07-22 21:23:01 +02:00
parent f9cfd134b7
commit 7261ab69bc
3 changed files with 7 additions and 3 deletions

View File

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