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:
2 files changed
+15
-2
No files matched your search
@@ -154,7 +154,20 @@ export class ModalRenderer {
|
|||||||
text: 'Export',
|
text: 'Export',
|
||||||
cls: 'mod-cta'
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export class GeneralSection implements ModalSection {
|
|||||||
|
|
||||||
new Setting(this.container)
|
new Setting(this.container)
|
||||||
.setName('Output folder')
|
.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 => {
|
.addText(text => {
|
||||||
const input = text
|
const input = text
|
||||||
.setPlaceholder('PDF exports')
|
.setPlaceholder('PDF exports')
|
||||||
|
|||||||
Reference in new issue
Block a user