Skip to content

feat(frontend): add reusable ApiError component with improved API error handling#31

Open
S-Garvit wants to merge 2 commits intoClimate-Vision:mainfrom
S-Garvit:feature/api-error-banner
Open

feat(frontend): add reusable ApiError component with improved API error handling#31
S-Garvit wants to merge 2 commits intoClimate-Vision:mainfrom
S-Garvit:feature/api-error-banner

Conversation

@S-Garvit
Copy link
Copy Markdown

Summary

Adds a reusable ApiError component and improves API error handling across the frontend.

Changes

  • Created a reusable ApiError UI component
  • Replaced toast-based error handling with inline error display
  • Improved error extraction from API responses (e.response?.data?.detail || e.message)
  • Added dismiss functionality for error messages
  • Ensured error state is reset before new requests

Affected Files

  • frontend/src/components/ui/ApiError.tsx
  • frontend/src/pages/NewAnalysis.tsx
  • frontend/src/pages/Upload.tsx

Why this change?

  • Provides a consistent and user-friendly way to display API errors
  • Makes error handling more predictable and maintainable
  • Improves UX by showing errors directly in context instead of transient toasts

Testing

  • Triggered API errors manually (invalid inputs / failed requests)
  • Verified error messages display correctly
  • Verified dismiss button clears the error

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant