[PR #5225] [MERGED] chore: use defineErrorCodes for errors #14113

Closed
opened 2026-04-13 09:19:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5225
Author: @himself65
Created: 10/10/2025
Status: Merged
Merged: 10/10/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/10/10/define-error


📝 Commits (1)

  • d01961d chore: use defineErrorCodes for errors

📊 Changes

11 files changed (+58 additions, -42 deletions)

View changed files

📝 packages/better-auth/src/plugins/anonymous/index.ts (+8 -6)
📝 packages/better-auth/src/plugins/api-key/index.ts (+3 -2)
📝 packages/better-auth/src/plugins/device-authorization/index.ts (+3 -2)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+9 -7)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+5 -3)
📝 packages/better-auth/src/plugins/haveibeenpwned/index.ts (+3 -2)
📝 packages/better-auth/src/plugins/multi-session/index.ts (+4 -4)
📝 packages/better-auth/src/plugins/passkey/index.ts (+12 -10)
📝 packages/better-auth/src/plugins/phone-number/phone-number-error.ts (+4 -2)
📝 packages/better-auth/src/plugins/two-factor/error-code.ts (+4 -2)
📝 packages/stripe/src/index.ts (+3 -2)

📄 Description

Summary by cubic

Standardized error code definitions across auth plugins by replacing inline constants with defineErrorCodes. No runtime behavior changes; improves type safety and consistency.

  • Refactors
    • Switched to defineErrorCodes in: anonymous, api-key, device-authorization, email-otp, generic-oauth, haveibeenpwned, multi-session, passkey, phone-number, two-factor, and stripe.
    • Kept existing export names and error keys the same.

🔄 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/5225 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/10/2025 **Status:** ✅ Merged **Merged:** 10/10/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/10/10/define-error` --- ### 📝 Commits (1) - [`d01961d`](https://github.com/better-auth/better-auth/commit/d01961dd696e8173b88b9f055a4b0c1f20fddd44) chore: use `defineErrorCodes` for errors ### 📊 Changes **11 files changed** (+58 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/anonymous/index.ts` (+8 -6) 📝 `packages/better-auth/src/plugins/api-key/index.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/device-authorization/index.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+9 -7) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+5 -3) 📝 `packages/better-auth/src/plugins/haveibeenpwned/index.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/multi-session/index.ts` (+4 -4) 📝 `packages/better-auth/src/plugins/passkey/index.ts` (+12 -10) 📝 `packages/better-auth/src/plugins/phone-number/phone-number-error.ts` (+4 -2) 📝 `packages/better-auth/src/plugins/two-factor/error-code.ts` (+4 -2) 📝 `packages/stripe/src/index.ts` (+3 -2) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Standardized error code definitions across auth plugins by replacing inline constants with defineErrorCodes. No runtime behavior changes; improves type safety and consistency. - **Refactors** - Switched to defineErrorCodes in: anonymous, api-key, device-authorization, email-otp, generic-oauth, haveibeenpwned, multi-session, passkey, phone-number, two-factor, and stripe. - Kept existing export names and error keys the same. <!-- 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-04-13 09:19:14 -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#14113