[PR #6823] [MERGED] chore(mongodb-adapter): add MongoAdapterError #32505

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6823
Author: @MuzzaiyyanHussain
Created: 12/17/2025
Status: Merged
Merged: 1/6/2026
Merged by: @himself65

Base: canaryHead: fix/mongodb-adapter-typed-error


📝 Commits (3)

  • 0578cf8 fix(mongodb-adapter): use MongoAdapterError instead of generic Error
  • de1fbb1 Merge branch 'canary' into fix/mongodb-adapter-typed-error
  • ad126ae Merge branch 'canary' into fix/mongodb-adapter-typed-error

📊 Changes

1 file changed (+16 additions, -7 deletions)

View changed files

📝 packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts (+16 -7)

📄 Description

Replaced generic Error throws in the MongoDB adapter with MongoAdapterError.
This aligns error handling with other adapters and improves type safety and debuggability without changing runtime behaviour


Summary by cubic

Switched the MongoDB adapter to use MongoAdapterError with typed codes for invalid IDs and unsupported operators. Improves type safety and clarity, matching other adapters, without changing runtime behavior.

  • Refactors
    • Added MongoAdapterError with codes INVALID_ID and UNSUPPORTED_OPERATOR.
    • Replaced generic Error throws in ID serialization and where-clause operator handling.
    • Standardized error names/messages across adapters; runtime unchanged.

Written for commit ad126ae64d. 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/6823 **Author:** [@MuzzaiyyanHussain](https://github.com/MuzzaiyyanHussain) **Created:** 12/17/2025 **Status:** ✅ Merged **Merged:** 1/6/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/mongodb-adapter-typed-error` --- ### 📝 Commits (3) - [`0578cf8`](https://github.com/better-auth/better-auth/commit/0578cf8b84f3481e5a2d7300b58abd018211dd36) fix(mongodb-adapter): use MongoAdapterError instead of generic Error - [`de1fbb1`](https://github.com/better-auth/better-auth/commit/de1fbb1cba4e38fd075e3f434882d675bfb93b87) Merge branch 'canary' into fix/mongodb-adapter-typed-error - [`ad126ae`](https://github.com/better-auth/better-auth/commit/ad126ae64d136cc339d14e430075cf8cacf9a3aa) Merge branch 'canary' into fix/mongodb-adapter-typed-error ### 📊 Changes **1 file changed** (+16 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/mongodb-adapter/mongodb-adapter.ts` (+16 -7) </details> ### 📄 Description Replaced generic Error throws in the MongoDB adapter with MongoAdapterError. This aligns error handling with other adapters and improves type safety and debuggability without changing runtime behaviour <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Switched the MongoDB adapter to use MongoAdapterError with typed codes for invalid IDs and unsupported operators. Improves type safety and clarity, matching other adapters, without changing runtime behavior. - **Refactors** - Added MongoAdapterError with codes INVALID_ID and UNSUPPORTED_OPERATOR. - Replaced generic Error throws in ID serialization and where-clause operator handling. - Standardized error names/messages across adapters; runtime unchanged. <sup>Written for commit ad126ae64d136cc339d14e430075cf8cacf9a3aa. 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:18:23 -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#32505