Skip to content

fix(admin): surface API error message in assign role toast#1644

Merged
paanSinghCoder merged 1 commit into
mainfrom
fix/assign-role-error-message
May 22, 2026
Merged

fix(admin): surface API error message in assign role toast#1644
paanSinghCoder merged 1 commit into
mainfrom
fix/assign-role-error-message

Conversation

@paanSinghCoder
Copy link
Copy Markdown
Contributor

@paanSinghCoder paanSinghCoder commented May 22, 2026

The Assign Role dialog catch blocks were swallowing the server's error and showing only a generic "Failed to assign role" toast. The actual reason (e.g. `last member cannot change role`) was never visible to the user.

Forwards `ConnectError.rawMessage` into the toast `description` field for both the org-level and project-level Assign Role dialogs. Falls back to no description for non-`ConnectError` errors → toast behavior is unchanged for those.

Affected paths:

  • web/sdk/admin/components/AssignRole.tsx
    paths:

    1. /workspaces/{orgId}/members → row action menu on a member → "Assign role…"
    2. /users/{userId} → side panel → membership row → role dropdown → "Assign role…"
  • web/sdk/admin/views/organizations/details/projects/members/assign-role.tsx
    Paths:

    1. /workspaces/{orgId}/projects → click a project row (opens the Project Members dialog) → row action menu on a member → "Assign role…"

The Assign Role dialog was swallowing the server's error and only
showing a generic "Failed to assign role" toast. When the API rejects
the request (e.g. last owner cannot change role), the user couldn't
see why. Forward the server's rawMessage into the toast description.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

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

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3cdd0bef-1780-42d0-a437-3b977e1a73bb

📥 Commits

Reviewing files that changed from the base of the PR and between a9f2e87 and bcea3d4.

📒 Files selected for processing (2)
  • web/sdk/admin/components/AssignRole.tsx
  • web/sdk/admin/views/organizations/details/projects/members/assign-role.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error messaging for role assignment failures to display detailed error information instead of generic messages, providing better visibility into what went wrong.

Walkthrough

Two role-assignment files are updated to enhance error reporting: AssignRole.tsx and assign-role.tsx both import ConnectError and replace generic error toasts with structured messages that include error.rawMessage when the error is a ConnectError, while success toasts remain unchanged.

Changes

Enhanced error toast messaging on role assignment

Layer / File(s) Summary
Enhanced error toast in AssignRole component
web/sdk/admin/components/AssignRole.tsx
ConnectError is imported and the role-assignment failure toast is updated to include a description field populated from error.rawMessage when a ConnectError is caught.
Enhanced error toast in assign-role view
web/sdk/admin/views/organizations/details/projects/members/assign-role.tsx
ConnectError is imported and the failure toast in onSubmit is replaced with a structured toast containing a title and optional description derived from error.rawMessage; the success toast remains unchanged.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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

Coverage Report for CI Build 26273828643

Coverage remained the same at 42.592%

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: 37953
Covered Lines: 16165
Line Coverage: 42.59%
Coverage Strength: 11.91 hits per line

💛 - Coveralls

@paanSinghCoder paanSinghCoder merged commit 7fae42c into main May 22, 2026
8 checks passed
@paanSinghCoder paanSinghCoder deleted the fix/assign-role-error-message branch May 22, 2026 08:34
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.

3 participants