Skip to content

fix(admin): surface API error message in toasts#1653

Draft
paanSinghCoder wants to merge 3 commits into
mainfrom
fix/admin-surface-server-error-toast
Draft

fix(admin): surface API error message in toasts#1653
paanSinghCoder wants to merge 3 commits into
mainfrom
fix/admin-surface-server-error-toast

Conversation

@paanSinghCoder
Copy link
Copy Markdown
Contributor

@paanSinghCoder paanSinghCoder commented May 27, 2026

Summary

Admin toasts were either hiding the server's error reason behind a generic message, or showing it with the raw gRPC code prefix (e.g. [failed_precondition] ...). This PR makes admin error toasts surface the clean, human-readable server message in the toast description.

Two related changes:

  1. Surface the message where it was dropped — catch blocks that only showed a generic title now forward error instanceof ConnectError ? error.rawMessage : undefined into description.
  2. Strip the [code] prefix — toasts that already showed the server message via error.message (which connect-es formats as [code] message) now use error.rawMessage (the message without the prefix). rawMessage is always a string on a ConnectError, and every call is guarded, so behavior is unchanged for non-ConnectError errors.

Affected paths & the message users will now see

Newly surfaced (previously generic title only)

Path RPC Example message now shown
organizations/details/projects/members/remove-member.tsx removeProjectMember "principal is not a member of the resource"
organizations/details/projects/rename-project.tsx updateProject "already exist" / "not found"
preferences/details.tsx createPreferences "invalid value for preference"
webhooks/webhooks/create/index.tsx createWebhook "internal server error" *
webhooks/webhooks/update/index.tsx updateWebhook "internal server error" *
webhooks/webhooks/delete/index.tsx deleteWebhook "internal server error" *

Prefix removed ([code] msg → clean msg)

Path RPC Example message now shown
organizations/details/members/remove-member.tsx removeOrganizationMember "cannot change role: this is the last owner of the organization"
organizations/details/security/block-organization.tsx disable/enableOrganization "internal server error" *
organizations/details/security/domains-list.tsx deleteOrganizationDomain "domain whitelist request doesn't exist"
organizations/details/layout/add-tokens-dialog.tsx delegatedCheckout "internal server error" *
organizations/details/layout/invite-users-dialog.tsx createOrganizationInvitation "principal is already a member of the resource" / "Invalid email"
organizations/details/edit/billing.tsx updateBillingAccountDetails "cannot create predated invoices: due in days should be greater than 0"
organizations/details/edit/kyc.tsx setOrganizationKyc "link cannot be empty" / "org doesn't exist"
organizations/details/projects/use-add-project-members.tsx setProjectMemberRole "role is not valid for project scope"
users/list/invite-users.tsx createOrganizationInvitation "principal is already a member of the resource" / "Invalid email"
users/details/security/block-user.tsx disable/enableUser "user doesn't exist"
users/details/security/sessions/revoke-session-final-confirm.tsx revokeUserSession "invalid session_id format: must be a valid UUID"

* These backend handlers currently map all failures to a generic internal server error, so the description shows that until the backend returns more specific errors. This is no worse than the previous generic toast, and verified non-empty so the description never renders blank.

Test plan

  • Trigger a failing action on each path (e.g. remove the last org owner, rename a project to a duplicate name, invite an already-member user) and confirm the toast description shows the clean server message
  • Confirm no toast shows a [failed_precondition]-style [code] prefix anymore
  • Confirm non-ConnectError failures still render a toast with no description (unchanged)

🤖 Generated with Claude Code

Forward ConnectError.rawMessage into the toast description for the
remaining admin catch blocks that previously showed only a generic
error: project member removal, project rename, preference save, and
webhook create/update/delete. Falls back to no description for
non-ConnectError errors so behavior is unchanged for those.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment May 27, 2026 11:17am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 43b0bf38-b84a-469e-b152-764f19a63336

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@coveralls
Copy link
Copy Markdown

coveralls commented May 27, 2026

Coverage Report for CI Build 26507871146

Coverage remained the same at 42.847%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37846
Covered Lines: 16216
Line Coverage: 42.85%
Coverage Strength: 12.0 hits per line

💛 - Coveralls

…tions

Refactor error handling across various admin components to display the rawMessage from ConnectError in toast notifications instead of the generic error message. This change enhances the clarity of error reporting for users.
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.

2 participants