Alex
PPrisma
•Created by Alex on 7/15/2024 in #help-and-questions
Error.code not defined for Deadlock & 40P01 error
Hi there,
My script sometimes breaks as I've encounter a deadlock error.
The error is the following one:
Unfortunately this error (40P01) doesn't seem to be handled correctly. I mean it's defined as a PrismaClientUnknownRequestError and so I can't get any error.code I can use in a try / catch block to handle it properly.
When doing a console.log(error) I get the above text so the only way to handle the error is to use error.includes('deadlock detected'); which isn't a proper solution.
Even the documentation doesn't mention this error : https://www.prisma.io/docs/orm/reference/error-reference#error-codes
Any idea about this?
Thanks for your time!
2 replies