Skip to content

fix(ui): update error parsing to handle standardized AppError responses#273

Merged
yash-pouranik merged 2 commits into
geturbackend:mainfrom
Ayush4958:fix-ui-error-handling
Jun 6, 2026
Merged

fix(ui): update error parsing to handle standardized AppError responses#273
yash-pouranik merged 2 commits into
geturbackend:mainfrom
Ayush4958:fix-ui-error-handling

Conversation

@Ayush4958
Copy link
Copy Markdown
Contributor

@Ayush4958 Ayush4958 commented Jun 5, 2026

🚀 Pull Request Description

I have updated the UI of web-dashboard to handle new modified API

Fixes #272

🛠️ Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 UI/UX improvement (Frontend only)
  • ⚙️ Refactor / Chore

🧪 Testing & Validation

Backend Verification:

  • I have run npm test in the backend/ directory and all tests passed.
  • I have verified the API endpoints using Postman/Thunder Client.
  • New unit tests have been added (if applicable).

Frontend Verification:

  • I have run npm run lint in the frontend/ directory.
  • Verified the UI changes on different screen sizes (Responsive).
  • Checked for any console errors in the browser dev tools.

📸 Screenshots / Recordings (Optional)

✅ Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings or errors.
  • I have updated the documentation (README/Docs) accordingly.

Built with ❤️ for urBackend.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error messaging throughout the dashboard when user actions fail (creating releases, projects, collections, managing webhooks, authentication, and settings), now displaying more detailed and specific error information to help you understand what went wrong.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Need an answer fast? Review this PR in Change Stack to ask focused questions about the PR or a changed range.

Review Change Stack

Warning

Review limit reached

@Ayush4958, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 34 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a56ff759-f527-48a8-a0c0-d86ee23eb80a

📥 Commits

Reviewing files that changed from the base of the PR and between 3a9dbff and 4fb6073.

📒 Files selected for processing (1)
  • apps/web-dashboard/src/pages/Webhooks.jsx
📝 Walkthrough

Walkthrough

The PR standardizes error message extraction across the web-dashboard. API error handlers in 8 pages and 1 utility now prefer err.response?.data?.message with fallback to err.response?.data?.error and generic failure strings, replacing prior inconsistent error field selection and aligning with a new backend API response shape.

Changes

Standardize error message extraction across web-dashboard

Layer / File(s) Summary
Utility layer error extraction
apps/web-dashboard/src/utils/api.js
The 403 response handler is reformatted to inline the message/error fallback chain on a single line.
User authentication and account flows
apps/web-dashboard/src/pages/Auth.jsx, apps/web-dashboard/src/pages/OtpVerification.jsx, apps/web-dashboard/src/pages/Settings.jsx
Delete user, reset password, save user, OTP send/verify/resend, password change, and account deletion error handlers now prefer message over error in API responses.
Resource creation operations
apps/web-dashboard/src/pages/AdminCreateRelease.jsx, apps/web-dashboard/src/pages/CreateCollection.jsx, apps/web-dashboard/src/pages/CreateProject.jsx
Release, collection, and project creation error handlers now prefer message over error in API error responses.
Project settings and webhooks
apps/web-dashboard/src/pages/ProjectSettings.jsx, apps/web-dashboard/src/pages/Webhooks.jsx
Error handlers across resend mail, database config, storage config, allowed domains forms, and webhook create/update/test operations now prefer message over error in API responses.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • geturbackend/urBackend#66: Aligns with backend middleware standardizing error responses into a consistent shape with error and message fields.
  • geturbackend/urBackend#270: Complements the standardized backend error response format (success: false, error, message) by updating frontend error extraction logic.

Suggested labels

GSSOC'26, level:intermediate, quality:clean, type:refactor, mentor:yash-pouranik

Suggested reviewers

  • yash-pouranik

Poem

🐰 Messages now take the lead,
Errors polished, the dashboards freed,
Fallbacks nested, all branches clear,
API responses finally sincere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(ui): update error parsing to handle standardized AppError responses' accurately describes the main change: updating UI error parsing for new standardized API responses.
Linked Issues check ✅ Passed All changes directly address issue #272 by updating error message parsing across UI pages to handle the new standardized AppError response format with message/error fallback chains.
Out of Scope Changes check ✅ Passed All nine modified files contain only error parsing updates related to the standardized AppError response format; no unrelated refactoring, feature additions, or out-of-scope changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web-dashboard/src/pages/ProjectSettings.jsx (1)

827-831: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard errorMsg type before calling .includes().

At Line 828, errorMsg.includes(...) can throw when err.response?.data?.message is not a string (e.g., validation object), causing the error handler itself to fail.

Proposed fix
-            const errorMsg = err.response?.data?.message || err.response?.data?.error || "Failed to update DB config";
-            if (errorMsg.includes("whitelist Server IP")) {
+            const rawMsg = err.response?.data?.message || err.response?.data?.error;
+            const errorMsg = typeof rawMsg === "string"
+                ? rawMsg
+                : (rawMsg?.message || "Failed to update DB config");
+            if (typeof errorMsg === "string" && errorMsg.includes("whitelist Server IP")) {
                 toast.error(<div><b>Access Denied!</b><br />{errorMsg}</div>, { duration: 6000 });
             } else {
                 toast.error(errorMsg);
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web-dashboard/src/pages/ProjectSettings.jsx` around lines 827 - 831, The
error handler builds errorMsg from err.response?.data but calls
errorMsg.includes(...) without ensuring it's a string; guard the check by
verifying typeof errorMsg === "string" before calling .includes (or convert
errorMsg to a string via String(...) or JSON.stringify(...) for non-strings),
and then call toast.error accordingly; update the block that defines errorMsg
and the conditional that checks for the "whitelist Server IP" substring to use
this type-safe check so the error handler won't throw when err.response?.data is
an object.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web-dashboard/src/pages/Webhooks.jsx`:
- Around line 146-147: The error payload may be an object/array so normalize it
to a safe string before calling toast.error or rendering; in Webhooks.jsx update
the logic that builds msg (currently using err.response?.data?.message ||
err.response?.data?.error || ...) to coerce non-string values to a readable
string (e.g. if it's an array join items, if it's an object use JSON.stringify
or extract known fields) and use that normalized string for toast.error(msg) and
for rendering testResult.error in JSX so React never receives an object/array
directly.

---

Outside diff comments:
In `@apps/web-dashboard/src/pages/ProjectSettings.jsx`:
- Around line 827-831: The error handler builds errorMsg from err.response?.data
but calls errorMsg.includes(...) without ensuring it's a string; guard the check
by verifying typeof errorMsg === "string" before calling .includes (or convert
errorMsg to a string via String(...) or JSON.stringify(...) for non-strings),
and then call toast.error accordingly; update the block that defines errorMsg
and the conditional that checks for the "whitelist Server IP" substring to use
this type-safe check so the error handler won't throw when err.response?.data is
an object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f11737cd-f6fd-4ebe-925a-c78c293ca137

📥 Commits

Reviewing files that changed from the base of the PR and between c2fe1fe and 3a9dbff.

📒 Files selected for processing (9)
  • apps/web-dashboard/src/pages/AdminCreateRelease.jsx
  • apps/web-dashboard/src/pages/Auth.jsx
  • apps/web-dashboard/src/pages/CreateCollection.jsx
  • apps/web-dashboard/src/pages/CreateProject.jsx
  • apps/web-dashboard/src/pages/OtpVerification.jsx
  • apps/web-dashboard/src/pages/ProjectSettings.jsx
  • apps/web-dashboard/src/pages/Settings.jsx
  • apps/web-dashboard/src/pages/Webhooks.jsx
  • apps/web-dashboard/src/utils/api.js

Comment thread apps/web-dashboard/src/pages/Webhooks.jsx Outdated
@Ayush4958
Copy link
Copy Markdown
Contributor Author

@yash-pouranik ,
PR is ready for review
done all changes requested by code rabbit

Copy link
Copy Markdown
Collaborator

@yash-pouranik yash-pouranik left a comment

Choose a reason for hiding this comment

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

Everything looks good, Thank you.

@yash-pouranik yash-pouranik merged commit e691984 into geturbackend:main Jun 6, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: UI is not able to handle new Response

2 participants