Expose error codes #1377

Closed
opened 2026-03-13 08:35:51 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @xn1cklas on GitHub (Jun 18, 2025).

Is this suited for github?

  • Yes, this is suited for github

When using better-auth in an app facing non-english users, all errors have to be retrieved from Github to map on to translated feedback messages.

Describe the solution you'd like

Provide a way to expose the error codes , so they can be mapped onto custom errors. This is needed to render internationalization in frontends.

Describe alternatives you've considered

Copy error code from github and map them manually.

Additional context

No response

Originally created by @xn1cklas on GitHub (Jun 18, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When using better-auth in an app facing non-english users, all errors have to be retrieved from Github to map on to translated feedback messages. ### Describe the solution you'd like Provide a way to expose the [error codes ](https://github.com/better-auth/better-auth/blob/fd62eba1d0ec71b3abb17ece92a4aae0c3c85270/packages/better-auth/src/error/codes.ts#L16), so they can be mapped onto custom errors. This is needed to render internationalization in frontends. ### Describe alternatives you've considered Copy error code from github and map them manually. ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 08:35:51 -05:00
Author
Owner

@ping-maxwell commented on GitHub (Jul 1, 2025):

We expose the error codes under auth.$ERROR_CODES

@ping-maxwell commented on GitHub (Jul 1, 2025): We expose the error codes under `auth.$ERROR_CODES`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1377