Skip to content

Commit

Permalink
Show error message if failing to unserialize note data (e.g. if a not…
Browse files Browse the repository at this point in the history
…e's format has a major version that is unsupported)
  • Loading branch information
heyman committed Oct 29, 2024
1 parent bca502f commit 28a44b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { todoCheckboxPlugin} from "./todo-checkbox.ts"
import { links } from "./links.js"
import { NoteFormat } from "../common/note-format.js"
import { useNotesStore } from "../stores/notes-store.js";
import { useErrorStore } from "../stores/error-store.js";


function getKeymapExtensions(editor, keymap) {
Expand Down Expand Up @@ -66,6 +67,7 @@ export class HeynoteEditor {
this.setDefaultBlockLanguage(defaultBlockToken, defaultBlockAutoDetect)
this.contentLoaded = false
this.notesStore = useNotesStore()
this.errorStore = useErrorStore()
this.name = ""


Expand Down Expand Up @@ -178,6 +180,7 @@ export class HeynoteEditor {
this.setReadOnly(false)
} catch (e) {
this.setReadOnly(true)
this.errorStore.addError(`Failed to load note: ${e.message}`)
throw new Error(`Failed to load note: ${e.message}`)
}
this.name = this.note.metadata?.name || this.path
Expand Down

0 comments on commit 28a44b8

Please sign in to comment.