[GH-ISSUE #3269] Raise APIError messages with codes, not just string messages #9548

Closed
opened 2026-04-13 05:03:20 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @rebasecase on GitHub (Jul 5, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3269

e.g.

57baf02f84/packages/better-auth/src/plugins/admin/admin.ts (L735-L738)

Describe the solution you'd like

error object that is {message, error} or whatever with enum value

Alternative would be matching error.message === message butt this matches by value not reference so it's not great (or robust)

Originally created by @rebasecase on GitHub (Jul 5, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3269 ### Is your feature request related to a problem? Please describe. e.g. https://github.com/better-auth/better-auth/blob/57baf02f84a45be794b069fcce3bc8f528c6208e/packages/better-auth/src/plugins/admin/admin.ts#L735-L738 ### Describe the solution you'd like error object that is `{message, error}` or whatever with enum value Alternative would be matching error.message === message butt this matches by value not reference so it's not great (or robust)
GiteaMirror added the enhancementlocked labels 2026-04-13 05:03:20 -05:00
Author
Owner

@ping-maxwell commented on GitHub (Aug 12, 2025):

I think it's an understandable request, I've added this to our backlogs.

<!-- gh-comment-id:3180971971 --> @ping-maxwell commented on GitHub (Aug 12, 2025): I think it's an understandable request, I've added this to our backlogs.
Author
Owner

@dosubot[bot] commented on GitHub (Nov 11, 2025):

Hi, @rebasecase. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested that APIError messages include error codes or enums alongside string messages to improve error handling robustness.
  • You proposed using an error object containing both message and error code instead of relying on matching error message strings.
  • Maintainer ping-maxwell acknowledged the request as understandable and added it to the backlog.
  • You reacted positively to the maintainer's response.
  • The issue remains unresolved with no further updates.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of better-auth by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3517668374 --> @dosubot[bot] commented on GitHub (Nov 11, 2025): Hi, @rebasecase. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested that APIError messages include error codes or enums alongside string messages to improve error handling robustness. - You proposed using an error object containing both message and error code instead of relying on matching error message strings. - Maintainer ping-maxwell acknowledged the request as understandable and added it to the backlog. - You reacted positively to the maintainer's response. - The issue remains unresolved with no further updates. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of better-auth by commenting here to keep the discussion open. - Otherwise, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@ping-maxwell commented on GitHub (Feb 19, 2026):

Hey this is now a thing.

<!-- gh-comment-id:3929982985 --> @ping-maxwell commented on GitHub (Feb 19, 2026): Hey this is now a thing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9548