Skip to content

fix(adapter-prisma): update error handling to Prisma's recommended approach #12862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/adapter-prisma/src/index.ts
Original file line number Diff line number Diff line change
@@ -15,8 +15,7 @@
*
* @module @auth/prisma-adapter
*/
import { type PrismaClient } from "@prisma/client"
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library"
import { type PrismaClient, Prisma } from "@prisma/client"
import type {
Adapter,
AdapterAccount,
@@ -90,7 +89,7 @@ export function PrismaAdapter(
// If token already used/deleted, just return null
// https://www.prisma.io/docs/reference/api-reference/error-reference#p2025
if (
error instanceof PrismaClientKnownRequestError &&
error instanceof Prisma.PrismaClientKnownRequestError &&
error.code === "P2025"
)
return null