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.
This commit is contained in:
AlexKucera committed 2025-11-08 19:07:55 +01:00
1 parent a71b20e9ba
commit 6c28b82a16
2 files changed
+15 -2

No files matched your search

+14 -1
View File
@@ -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);
});
});
}
/**
+1 -1
View File
@@ -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')