Skip to content

fix(web): return invite/accept errors as values instead of throwing - #566

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
arambu1a:fix/invite-accept-error-handling
Jul 31, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
arambu1a:fix/invite-accept-error-handling

Conversation

@arambu1a

@arambu1a arambu1a commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • inviteMember and acceptInvitation threw on common, user-reachable failures (duplicate invite, wrong account, expired token, invalid email, insert errors), which production masks as a digest string instead of showing the actionable message.
  • Both now return { error: string } instead of throwing, following the pattern from fix(prompts): surface savePromptSet failures instead of the masked digest error #536 (addPromptToBrand).
  • team-section.tsx branches on the invite result and toasts the error.
  • accept-invitation-card.tsx branches on the accept result and renders the error inline (inline beats a toast here since it tells the user what to do next, e.g. which account to sign in with).

Closes #548

Test plan

  • tsc --noEmit passes
  • npm run lint passes
  • Manually verify: inviting the same email twice shows "A pending invitation already exists for this email"
  • Manually verify: accepting an invite link while signed in with a different account shows the "sign in with that email" message inline on the card

arambu1a added 2 commits July 30, 2026 15:19
inviteMember and acceptInvitation threw on common, user-reachable
failures (duplicate invite, wrong account, expired token, etc.). In
production a thrown server action surfaces as the masked digest
string, hiding the actionable message. Both now return `{ error }`
and the call sites branch on it, following the pattern from ansvisor#536.

Closes ansvisor#550

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks — solid work again. The inline error on the accept card (instead of a toast) is exactly the right call. 🙌

@gkhngyk
gkhngyk merged commit 3182b69 into ansvisor:main Jul 31, 2026
3 checks passed
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.

Team invitations: inviteMember / acceptInvitation throw — users see the masked digest error instead of actionable messages

2 participants