[PR #7347] [MERGED] chore(core): fix error.cause in BetterAuthError #32850

Closed
opened 2026-04-17 23:33:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7347
Author: @himself65
Created: 1/14/2026
Status: Merged
Merged: 1/14/2026
Merged by: @himself65

Base: canaryHead: himself65/2026/01/13/fix-cause


📝 Commits (3)

📊 Changes

4 files changed (+14 additions, -12 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/index.ts (+3 -6)
📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+6 -2)
📝 packages/better-auth/src/utils/url.ts (+3 -1)
📝 packages/core/src/error/index.ts (+2 -3)

📄 Description

Related: 05098a8d12


Summary by cubic

Fixes BetterAuthError to correctly set error.cause using native Error options, improving debugging and error chaining. Also clarifies JWT plugin configuration errors.

  • Bug Fixes
    • BetterAuthError now accepts { cause } and passes it to Error; url assertions attach the original error as cause.
    • JWT plugin error messages now reference exact option paths (e.g., options.jwks.remoteUrl, options.jwks.keyPairConfig.alg, options.jwks.jwksPath).

Written for commit b2c2ed6f2b. Summary will update on new commits.


🔄 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/7347 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/14/2026 **Status:** ✅ Merged **Merged:** 1/14/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2026/01/13/fix-cause` --- ### 📝 Commits (3) - [`871194a`](https://github.com/better-auth/better-auth/commit/871194abc9a225de3473e17de2c68fb87bc718cf) chore(core): fix error.cause in `BetterAuthError` - [`9e83eab`](https://github.com/better-auth/better-auth/commit/9e83eab522a28c8dad2436c76be7c6e204db54e6) fix: test - [`b2c2ed6`](https://github.com/better-auth/better-auth/commit/b2c2ed6f2bfce35aef1c1307bab52ca76f5d9ce7) fix: lint ### 📊 Changes **4 files changed** (+14 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+3 -6) 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+6 -2) 📝 `packages/better-auth/src/utils/url.ts` (+3 -1) 📝 `packages/core/src/error/index.ts` (+2 -3) </details> ### 📄 Description Related: https://github.com/better-auth/better-auth/pull/6675/changes/05098a8d1285cf48ff2dfb2fad8a48fe2386c81f <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes BetterAuthError to correctly set error.cause using native Error options, improving debugging and error chaining. Also clarifies JWT plugin configuration errors. - **Bug Fixes** - BetterAuthError now accepts { cause } and passes it to Error; url assertions attach the original error as cause. - JWT plugin error messages now reference exact option paths (e.g., options.jwks.remoteUrl, options.jwks.keyPairConfig.alg, options.jwks.jwksPath). <sup>Written for commit b2c2ed6f2bfce35aef1c1307bab52ca76f5d9ce7. Summary will update on new commits.</sup> <!-- 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-17 23:33:57 -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#32850