Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: catch error when setting color

thecodrr29703646bb6e
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index aa440afba..8dd41548b 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -110,13 +110,17 @@ class NoteStore extends BaseStore {
};
setColor = async (id, color) => {
- let note = db.notes.note(id);
- if (!note) return;
- if (note.data.color === color) await db.notes.note(id).uncolor();
- else await db.notes.note(id).color(color);
- appStore.refreshColors();
- if (!this._syncEditor(note.id, "color", db.notes.note(id).data.color)) {
- this.refresh();
+ try {
+ let note = db.notes.note(id);
+ if (!note) return;
+ if (note.data.color === color) await db.notes.note(id).uncolor();
+ else await db.notes.note(id).color(color);
+ appStore.refreshColors();
+ if (!this._syncEditor(note.id, "color", db.notes.note(id).data.color)) {
+ this.refresh();
+ }
+ } catch (e) {
+ console.error(e);
}
};