Handling prisma errors

Hey, quick question. Let's suppose that in my db I have model User with few unique fields: name, surname, email
Should I validate manually that those fields are unique and throw an error if not or should I just let prisma do it?
I guess that the 2nd solution is better. How do I map prisma errors to show more human friendly messages than this:
{
    "statusCode": 500,
    "code": "P2002",
    "error": "Internal Server Error",
    "message": "\nInvalid `prisma.user.create()` invocation in\nC:\\Users\\-.-\\Desktop\\icerty\\apps\\server\\modules\\users\\users.routes.ts:78:40\n\n 78 const offer = await prisma.user.create(\nUnique constraint failed on the fields: (`name`)"
}
Was this page helpful?