-
Notifications
You must be signed in to change notification settings - Fork 262
Open
Description
the import from the tutorial
import { PrismaClientKnownRequestError } from '@prisma/client/runtime';Is not working as expected, instead when I import like below as per the documentation it works fine:
import { Prisma } from '@prisma/client';
// and try to match error instance in this way
if (error instanceof Prisma.PrismaClientKnownRequestError) {
console.log(error.message);
if (error.code === 'P2002') {
throw new ForbiddenException('Credentials taken');
}
}Hope this helps if anyone following along faces the same issue.
Doc link referred: https://www.prisma.io/docs/concepts/components/prisma-client/handling-exceptions-and-errors
guimox, xcplus, Ryu4fly and goose-intestine
Metadata
Metadata
Assignees
Labels
No labels