Throw error

pull/11421/merge^2
Sean Brydon 2023-09-14 11:47:16 +01:00
parent fc43e8544a
commit c1e63bcbda
1 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import { hashPassword } from "@calcom/features/auth/lib/hashPassword";
import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail"; import { sendEmailVerification } from "@calcom/features/auth/lib/verifyEmail";
import { WEBAPP_URL } from "@calcom/lib/constants"; import { WEBAPP_URL } from "@calcom/lib/constants";
import { getLocaleFromRequest } from "@calcom/lib/getLocaleFromRequest"; import { getLocaleFromRequest } from "@calcom/lib/getLocaleFromRequest";
import { HttpError } from "@calcom/lib/http-error";
import { createWebUser as syncServicesCreateWebUser } from "@calcom/lib/sync/SyncServiceManager"; import { createWebUser as syncServicesCreateWebUser } from "@calcom/lib/sync/SyncServiceManager";
import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager"; import { closeComUpsertTeamUser } from "@calcom/lib/sync/SyncServiceManager";
import { validateUsername } from "@calcom/lib/validateUsername"; import { validateUsername } from "@calcom/lib/validateUsername";
@ -39,8 +40,10 @@ async function handler(req: RequestWithUsernameStatus, res: NextApiResponse) {
// Validate the user // Validate the user
if (!username) { if (!username) {
res.status(422).json({ message: "Invalid username" }); throw new HttpError({
return; statusCode: 422,
message: "Invalid username",
});
} }
const email = _email.toLowerCase(); const email = _email.toLowerCase();