The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improve invitation error message
Steven Teycabbb72890de
diff --git a/apps/web/app/api/workspaces/[idOrSlug]/invites/route.ts b/apps/web/app/api/workspaces/[idOrSlug]/invites/route.tsindex 0e7913661f..693d0bea91 100644--- a/apps/web/app/api/workspaces/[idOrSlug]/invites/route.ts+++ b/apps/web/app/api/workspaces/[idOrSlug]/invites/route.ts@@ -145,12 +145,12 @@ export const POST = withWorkspace();if (results.some((result) => result.status === "rejected")) {+ const failedInvites = results.filter(+ (result) => result.status === "rejected",+ );throw new DubApiError({code: "bad_request",- message:- teammates.length > 1- ? "Some invitations could not be sent."- : "Invitation could not be sent.",+ message: `Failed to send ${pluralize("invitation", failedInvites.length)}: ${failedInvites.map((result) => result.reason.message).join(", ")}`,});}diff --git a/apps/web/lib/api/users.ts b/apps/web/lib/api/users.tsindex c2aa349beb..41259abc78 100644--- a/apps/web/lib/api/users.ts+++ b/apps/web/lib/api/users.ts@@ -39,7 +39,7 @@ export async function inviteUser({if (error.code === "P2002") {throw new DubApiError({code: "conflict",- message: "User has already been invited to this workspace.",+ message: `User ${email} has already been invited to this workspace.`,});}}