Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Merge branch 'main' into feat/improve-api

Kiran K5226f62de8bd
diff --cc apps/web/app/api/tags/route.ts
index e89ade4616,e551957008..a93a9a57d7
--- a/apps/web/app/api/tags/route.ts
+++ b/apps/web/app/api/tags/route.ts
@@@ -70,9 -53,13 +70,14 @@@ export const POST = withAuth(async ({ r
projectId: project.id,
},
});
- return NextResponse.json(response, { headers });
+
+ return NextResponse.json(response, { headers, status: 201 });
} catch (error) {
+ if (error.code === "P2002") {
- return new Response("A tag with the same name already exists.", {
- status: 409,
- });
++ error.code = "conflict";
++ error.message = "A tag with that name already exists.";
+ }
- return new Response(error.message, { status: 400 });
++
+ return handleAndReturnErrorResponse(error);
}
- });
+ });