mirror of
https://github.com/heyman/heynote.git
synced 2024-12-23 07:08:49 +01:00
Show error message if failing to unserialize note data (e.g. if a note's format has a major version that is unsupported)
This commit is contained in:
parent
d590c625bb
commit
f49ef4bec8
@ -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) {
|
||||
@ -66,6 +67,7 @@ export class HeynoteEditor {
|
||||
this.setDefaultBlockLanguage(defaultBlockToken, defaultBlockAutoDetect)
|
||||
this.contentLoaded = false
|
||||
this.notesStore = useNotesStore()
|
||||
this.errorStore = useErrorStore()
|
||||
this.name = ""
|
||||
|
||||
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user