[PR #3957] [MERGED] chore: Standardize error code capitalization and improve USER_ALREADY_EXISTS error code #5105

Closed
opened 2026-03-13 12:10:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3957
Author: @jonas-s-s-s
Created: 8/12/2025
Status: Merged
Merged: 8/13/2025
Merged by: @Bekacru

Base: canaryHead: canary


📝 Commits (2)

  • 58be6f3 Modify USER_ALREADY_EXISTS error code
  • 0896e25 Standardize error-codes style

📊 Changes

3 files changed (+10 additions, -10 deletions)

View changed files

📝 packages/better-auth/src/error/codes.ts (+1 -1)
📝 packages/better-auth/src/plugins/admin/error-codes.ts (+1 -1)
📝 packages/better-auth/src/plugins/username/error-codes.ts (+8 -8)

📄 Description

USER_ALREADY_EXISTS

This changes the USER_ALREADY_EXISTS error code from "User already exists" to "User already exists. Use another email." this signifies that the error was caused by entering an email that's already in the database (duplicate emails aren't allowed). It also helps to differentiate it from the USERNAME_IS_ALREADY_TAKEN error when using the username plugin.

Username plugin error codes

All strings in the USERNAME_ERROR_CODES struct have been changed to start with an uppercase letter, this ensures that the capitalization is the same as in the BASE_ERROR_CODES struct.


Summary by cubic

Updated the USER_ALREADY_EXISTS error code to give clearer guidance and standardized error code capitalization in the username plugin.

  • Error Code Improvements
  • Changed USER_ALREADY_EXISTS to "User already exists. Use another email."
  • Updated all username plugin error messages to start with an uppercase letter for consistency.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3957 **Author:** [@jonas-s-s-s](https://github.com/jonas-s-s-s) **Created:** 8/12/2025 **Status:** ✅ Merged **Merged:** 8/13/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (2) - [`58be6f3`](https://github.com/better-auth/better-auth/commit/58be6f31dd8bec8e828a3a580ec9092138660670) Modify USER_ALREADY_EXISTS error code - [`0896e25`](https://github.com/better-auth/better-auth/commit/0896e25c9d2c0c4af2e664c9dfaaca20ea28a836) Standardize error-codes style ### 📊 Changes **3 files changed** (+10 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/error/codes.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/admin/error-codes.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/username/error-codes.ts` (+8 -8) </details> ### 📄 Description # USER_ALREADY_EXISTS This changes the USER_ALREADY_EXISTS error code from `"User already exists"` to `"User already exists. Use another email."` this signifies that the error was caused by entering an email that's already in the database (duplicate emails aren't allowed). It also helps to differentiate it from the USERNAME_IS_ALREADY_TAKEN error when using the username plugin. # Username plugin error codes All strings in the USERNAME_ERROR_CODES struct have been changed to start with an uppercase letter, this ensures that the capitalization is the same as in the BASE_ERROR_CODES struct. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated the USER_ALREADY_EXISTS error code to give clearer guidance and standardized error code capitalization in the username plugin. - **Error Code Improvements** - Changed USER_ALREADY_EXISTS to "User already exists. Use another email." - Updated all username plugin error messages to start with an uppercase letter for consistency. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:10:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5105