Skip to content

fix: add error handling and user feedback for metric exports#2754

Open
MeeraSRaj wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
MeeraSRaj:fix-export-error-handling
Open

fix: add error handling and user feedback for metric exports#2754
MeeraSRaj wants to merge 4 commits into
Priyanshu-byte-coder:mainfrom
MeeraSRaj:fix-export-error-handling

Conversation

@MeeraSRaj

@MeeraSRaj MeeraSRaj commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #744

This PR improves the export experience by adding proper error handling and user feedback for CSV and PDF exports in the ExportButton component.

Changes Made

  • Added try-catch-finally error 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 finally blocks.

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:

  • Users receive clear feedback when an export fails.
  • Errors are logged for easier debugging.
  • The application no longer fails silently during export operations.

Testing

  • Verified CSV exports continue to work successfully.

  • Verified PDF exports continue to work successfully.

  • Simulated export failures and confirmed:

    • Loading states reset correctly.
    • Error toast notifications are displayed.
    • Errors are logged to the browser console.

Fixes the issue regarding missing error handling and user feedback in metric export actions.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Jun 23, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Legit-Ox Legit-Ox left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, merge after all CIs run succesfully

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] [BUG / UX] Lack of Robust Error Handling & User Notifications in ExportButton

3 participants