Update ESLint rules and resolve bot review feedback #8
@@ -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}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user
⚠️ Potential issue | 🟠 Major
Error handling should notify users, not just log to console
When a user-initiated command fails, logging to console provides no feedback to the user. They won't know why the export didn't happen. Consider showing a Notice with the error message so users understand what went wrong.
Apply this pattern for user-facing error handling:
🤖 Prompt for AI Agents
✅ Addressed in commits
f0daebctoc1c02ee