feat(frontend): add reusable ApiError component with improved API error handling#31
feat(frontend): add reusable ApiError component with improved API error handling#31S-Garvit wants to merge 6 commits into
Conversation
Oshgig
left a comment
There was a problem hiding this comment.
Thanks @S-Garvit — this is a clean implementation and the component itself is well-built (aria-live, dismiss button, Tailwind classes consistent with the rest of the UI). I appreciate the care.
Before we land it though, I want to flag that PR #56 (@liascope) is doing essentially the same thing for the same issue, and it landed in the queue first. That PR is already in CHANGES_REQUESTED waiting on two small fixes, and we're going to merge that one once it's updated.
A few options that respect the work you've put in:
- Help us land #56 faster. If you'd like, you can leave a code-review comment over there pointing at any improvements you think your version handles better (your
e?.response?.data?.detailparsing is genuinely nicer than justString(e)— that would be a great suggestion to lift over). - Follow-up PR after #56 merges. Once #56 is in, the
ApiErrorcomponent will exist; you can then open a smaller PR that adds the structurede?.response?.data?.detail || e?.response?.data?.message || e?.messageparsing pattern across both pages. That's a clear, focused improvement. - Close this one in favour of #56. Totally reasonable too — your contributions show up on your profile either way.
Whatever you prefer is fine. If I don't hear back I'll close this one in ~5 days in favour of #56 to avoid the queue staying confusing for other contributors. Sorry for the duplicate-work outcome — we'll get better at issue triage to prevent this in future.
Also, two small things on the diff itself for whatever path you take:
ApiError.tsxis missing a trailing newline (No newline at end of file).- In
Upload.tsxthe catch block no longer callsshowToast('error', ...), onlysetError(...). The toast onNewAnalysis.tsxis still there. Worth keeping the behaviour symmetric — pick one or the other for both pages.
Thanks again for engaging with the project.
|
📢 Heads-up: repo history was rewritten today (2026-05-18) We force-pushed a cleaned history across all branches to remove an internal directory from past commits. Your code and this PR are unaffected — only the commit SHAs underneath have shifted. GitHub will re-render the diff against the new base automatically. If you have a local clone, please bring it back in sync before pushing anything else: # Option A (simplest): fresh start
git clone https://github.com/Climate-Vision/ClimateVision.git
# Option B: rebase the existing PR branch in your fork
git fetch origin
git checkout <your-branch>
git rebase origin/main # likely no conflicts
git push --force-with-leaseDo not Apologies for the interruption — really appreciate your patience here. If anything looks off after rebasing, leave a comment and I'll help unblock right away. Thanks for contributing 🙏 |
Defines responsibilities, deliverables, and collaboration guidelines for the Carbon Analytics & Validation role. Co-Authored-By: Francis Umo <francis.umo@climatevision.org>
Defines responsibilities, deliverables, and collaboration guidelines for the API Development & Integration role. Co-Authored-By: Olufemi Taiwo <olufemi.taiwo@climatevision.org>
- Add DONE/PENDING task list for April 2026 sprint - Include actual .github/workflows/ci.yml code in role doc - Update local CI check commands to match current workflow
1572d16 to
441601e
Compare
Summary
Adds a reusable
ApiErrorcomponent and improves API error handling across the frontend.Changes
ApiErrorUI componente.response?.data?.detail || e.message)Affected Files
frontend/src/components/ui/ApiError.tsxfrontend/src/pages/NewAnalysis.tsxfrontend/src/pages/Upload.tsxWhy this change?
Testing