fix: add error handling and user feedback for metric exports#2754
fix: add error handling and user feedback for metric exports#2754MeeraSRaj wants to merge 4 commits into
Conversation
GSSoC Label Checklist 🏷️@Umbrella-io — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Legit-Ox
left a comment
There was a problem hiding this comment.
LGTM, merge after all CIs run succesfully
|
Good fix — the missing error handling was a real issue. One nit before merge: Indentation inconsistency — the catch block in exportCSV uses 6-space indent instead of the surrounding 4-space indent. Same in exportPDF where the catch body uses 9 spaces. Please align with the file's existing 4-space indent style. Also please remove the type:feature, type:design, and type:performance labels — this is a pure bug fix (adding missing catch blocks). Fix the indentation and this is good to go. |
Summary
Closes #744
This PR improves the export experience by adding proper error handling and user feedback for CSV and PDF exports in the
ExportButtoncomponent.Changes Made
Added
try-catch-finallyerror handling to:exportCSV()exportPDF()Added
console.error()logging to aid debugging when export operations fail.Added Sonner toast notifications to inform users when an export fails.
Preserved existing loading state behavior by keeping the
finallyblocks.Problem Solved
Previously, export operations could fail silently if an exception occurred during data fetching, file generation, or download preparation. Users would only see the loading state disappear without any indication of what went wrong.
With this change:
Testing
Verified CSV exports continue to work successfully.
Verified PDF exports continue to work successfully.
Simulated export failures and confirmed:
Fixes the issue regarding missing error handling and user feedback in metric export actions.