From 6c28b82a169d4724166ff07c3f47d1e7843d182c Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 8 Nov 2025 19:07:55 +0100 Subject: [PATCH] Improves error handling for export submissions Enhances export submission logic by adding error handling to manage failures, logging errors for debugging, and providing user feedback. Re-enables buttons post-failure for retry or cancellation. Updates description to clarify output folder path can be absolute or relative. Relates to user feedback on error transparency. --- src/ui/modal/ModalRenderer.ts | 15 ++++++++++++++- src/ui/modal/sections/GeneralSection.ts | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ui/modal/ModalRenderer.ts b/src/ui/modal/ModalRenderer.ts index 7e6bc9f..28be772 100644 --- a/src/ui/modal/ModalRenderer.ts +++ b/src/ui/modal/ModalRenderer.ts @@ -154,7 +154,20 @@ export class ModalRenderer { text: 'Export', cls: 'mod-cta' }); - this.submitButton.addEventListener('click', () => void this.callbacks.onSubmit()); + this.submitButton.addEventListener('click', () => { + this.setExportingState(true); + Promise.resolve(this.callbacks.onSubmit()).catch(err => { + // Log the error for debugging + console.error('Export submission failed:', err); + + // Show user-facing error feedback + const errorMessage = err instanceof Error ? err.message : 'An unknown error occurred during export'; + this.showValidationErrors([errorMessage]); + + // Re-enable buttons so user can try again or cancel + this.setExportingState(false); + }); + }); } /** diff --git a/src/ui/modal/sections/GeneralSection.ts b/src/ui/modal/sections/GeneralSection.ts index 4a9c11e..929b790 100644 --- a/src/ui/modal/sections/GeneralSection.ts +++ b/src/ui/modal/sections/GeneralSection.ts @@ -75,7 +75,7 @@ export class GeneralSection implements ModalSection { new Setting(this.container) .setName('Output folder') - .setDesc('Location for exported PDF files (relative to vault root)') + .setDesc('Location for exported PDF files (relative to vault root or absolute path)') .addText(text => { const input = text .setPlaceholder('PDF exports')