feat: validate team slug format and improve error handling in team creation

This commit is contained in:
2026-07-11 13:15:53 +08:00
parent acf7ae0cd7
commit 9c33a4e9b9
3 changed files with 14 additions and 4 deletions
+4 -1
View File
@@ -35,9 +35,11 @@ export async function handleRouteError(reply: FastifyReply, err: unknown): Promi
await sendError(reply, mapped.statusCode, mapped.code, mapped.message);
return;
}
reply.log.error({ err }, "unmapped route error");
await sendError(reply, 500, "internal_error", "internal error");
return;
}
reply.log.error({ err }, "unmapped route error");
await sendError(reply, 500, "internal_error", "internal error");
}
@@ -71,7 +73,8 @@ function mapDomainError(message: string): { statusCode: number; code: string; me
lower.includes("is required") ||
lower.includes("already") ||
lower.includes("invalid") ||
lower.includes("accepts only")
lower.includes("accepts only") ||
lower.includes("must be")
) {
return { statusCode: 400, code: "bad_request", message };
}