Add P2025to prisma errorhandler
This commit is contained in:
parent
fbd199c39a
commit
0d6b41abcf
@ -28,6 +28,11 @@ export function handlePrismaError(errorObj: any, res: Response, source: string)
|
|||||||
res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Relation object does not exist', meta: errorObj.meta });
|
res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Relation object does not exist', meta: errorObj.meta });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// P2025 -> "An operation failed because it depends on one or more records that were required but not found. {cause}"
|
||||||
|
case 'P2025':
|
||||||
|
res.status(404).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'Object does not exist', meta: errorObj.meta });
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
res.status(500).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'An error occurred during the database operation' });
|
res.status(500).json({ status: 'ERROR', errorcode: 'DB_ERROR', message: 'An error occurred during the database operation' });
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user