We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab0361c commit 10b8de0Copy full SHA for 10b8de0
src/lib/services/contest_task_pairs.ts
@@ -1,3 +1,5 @@
1
+import { Prisma } from '@prisma/client';
2
+
3
import { default as db } from '$lib/server/database';
4
5
import type { ContestTaskPair, ContestTaskPairs } from '$lib/types/contest_task_pair';
@@ -58,7 +60,7 @@ export async function createContestTaskPair(
58
60
59
61
console.log('Created ContestTaskPair:', contestTaskPair);
62
} catch (error) {
- if (error && typeof error === 'object' && 'code' in error && (error as any).code === 'P2002') {
63
+ if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === 'P2002') {
64
console.log(`ContestTaskPair already exists: contestId=${contestId}, taskId=${taskId}`);
65
return;
66
}
0 commit comments