Do not spam with expected invite errors (#10241)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko
2025-11-22 17:24:05 +07:00
committed by GitHub
parent c9ef10b083
commit a6c964a830
-3
View File
@@ -1105,13 +1105,11 @@ export async function createWorkspaceRecord (
export async function checkInvite (ctx: MeasureContext, invite: WorkspaceInvite, email: string): Promise<WorkspaceUuid> {
if (invite.remainingUses === 0) {
ctx.error('Invite limit exceeded', { email, ...invite })
Analytics.handleError(new Error(`Invite limit exceeded ${email}`))
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
}
if (invite.expiresOn > 0 && invite.expiresOn < Date.now()) {
ctx.error('Invite link expired', { email, ...invite })
Analytics.handleError(new Error(`Invite link expired ${invite.id} ${email}`))
throw new PlatformError(new Status(Severity.ERROR, platform.status.ExpiredLink, {}))
}
@@ -1129,7 +1127,6 @@ export async function checkInvite (ctx: MeasureContext, invite: WorkspaceInvite,
if (invite.email != null && invite.email.trim().length > 0 && invite.email !== email) {
ctx.error("Invite doesn't allow this email address", { email, ...invite })
Analytics.handleError(new Error(`Invite link email check failed ${invite.id} ${email} ${invite.email}`))
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
}