The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix error handling
Kiran K78c4cc40720c
diff --git a/apps/web/app/api/user/route.ts b/apps/web/app/api/user/route.tsindex 72a0ab5fb6..0412391902 100644--- a/apps/web/app/api/user/route.ts+++ b/apps/web/app/api/user/route.ts@@ -96,6 +96,9 @@ export const PATCH = withSession(async ({ req, session }) => {}}+ // TODO:+ // Email change should require a verification process before updating the email in the database+try {const response = await prisma.user.update({where: {@@ -125,10 +128,14 @@ export const PATCH = withSession(async ({ req, session }) => {return NextResponse.json(response);} catch (error) {- throw new DubApiError({- code: "conflict",- message: "Email is already in use.",- });+ if (error.code === "P2002") {+ throw new DubApiError({+ code: "conflict",+ message: "Email is already in use.",+ });+ }++ throw error;}});