diff --git a/src/plugin/CommandRegistry.ts b/src/plugin/CommandRegistry.ts index 714b3cf..be100b3 100644 --- a/src/plugin/CommandRegistry.ts +++ b/src/plugin/CommandRegistry.ts @@ -3,7 +3,7 @@ * Handles registration of all plugin commands and their callbacks */ -import { Editor, MarkdownView } from 'obsidian'; +import { Editor, MarkdownView, Notice } from 'obsidian'; import type { obsidianTypstPDFExport } from '../../main'; export class CommandRegistry { @@ -20,6 +20,8 @@ export class CommandRegistry { editorCallback: (editor: Editor, view: MarkdownView) => { this.plugin.exportCurrentNote(view).catch(error => { console.error('Failed to export current note:', error); + const errorMessage = error?.message ?? String(error); + new Notice(`Failed to export current note: ${errorMessage}`); }); } }); @@ -31,6 +33,8 @@ export class CommandRegistry { editorCallback: (editor: Editor, view: MarkdownView) => { this.plugin.showExportModal(view).catch(error => { console.error('Failed to show export modal:', error); + const errorMessage = error?.message ?? String(error); + new Notice(`Failed to show export modal: ${errorMessage}`); }); } }); @@ -42,6 +46,8 @@ export class CommandRegistry { callback: () => { this.plugin.showDependencyStatus().catch(error => { console.error('Failed to show dependency status:', error); + const errorMessage = error?.message ?? String(error); + new Notice(`Failed to show dependency status: ${errorMessage}`); }); } });