fix(admin): surface API error message in toasts#1653
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Coverage Report for CI Build 26507871146Coverage remained the same at 42.847%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - 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.
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 toastdescription.Two related changes:
error instanceof ConnectError ? error.rawMessage : undefinedintodescription.[code]prefix — toasts that already showed the server message viaerror.message(which connect-es formats as[code] message) now useerror.rawMessage(the message without the prefix).rawMessageis always a string on aConnectError, and every call is guarded, so behavior is unchanged for non-ConnectErrorerrors.Affected paths & the message users will now see
Newly surfaced (previously generic title only)
organizations/details/projects/members/remove-member.tsxremoveProjectMemberorganizations/details/projects/rename-project.tsxupdateProjectpreferences/details.tsxcreatePreferenceswebhooks/webhooks/create/index.tsxcreateWebhookwebhooks/webhooks/update/index.tsxupdateWebhookwebhooks/webhooks/delete/index.tsxdeleteWebhookPrefix removed (
[code] msg→ cleanmsg)organizations/details/members/remove-member.tsxremoveOrganizationMemberorganizations/details/security/block-organization.tsxdisable/enableOrganizationorganizations/details/security/domains-list.tsxdeleteOrganizationDomainorganizations/details/layout/add-tokens-dialog.tsxdelegatedCheckoutorganizations/details/layout/invite-users-dialog.tsxcreateOrganizationInvitationorganizations/details/edit/billing.tsxupdateBillingAccountDetailsorganizations/details/edit/kyc.tsxsetOrganizationKycorganizations/details/projects/use-add-project-members.tsxsetProjectMemberRoleusers/list/invite-users.tsxcreateOrganizationInvitationusers/details/security/block-user.tsxdisable/enableUserusers/details/security/sessions/revoke-session-final-confirm.tsxrevokeUserSession* 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
[failed_precondition]-style[code]prefix anymoreConnectErrorfailures still render a toast with no description (unchanged)🤖 Generated with Claude Code