From 949af13f724170adf806020f632c0403beb1bc77 Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Thu, 4 Apr 2024 16:00:43 -0500 Subject: [PATCH] Use proper error code when repo is blocked (#19600) --- components/server/src/workspace/workspace-starter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/server/src/workspace/workspace-starter.ts b/components/server/src/workspace/workspace-starter.ts index 1138b8bdb4b117..7a486b2b3e77a0 100644 --- a/components/server/src/workspace/workspace-starter.ts +++ b/components/server/src/workspace/workspace-starter.ts @@ -134,6 +134,7 @@ import { isGrpcError } from "@gitpod/gitpod-protocol/lib/util/grpc"; import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server"; import { ctxIsAborted, runWithRequestContext, runWithSubjectId } from "../util/request-context"; import { SubjectId } from "../auth/subject-id"; +import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error"; export interface StartWorkspaceOptions extends Omit { excludeFeatureFlags?: NamedWorkspaceFeatureFlag[]; @@ -509,7 +510,7 @@ export class WorkspaceStarter { log.error({ userId: user.id }, "Failed to block user.", error, { contextURL }); } } - throw new Error(`${contextURL} is blocklisted on Gitpod.`); + throw new ApplicationError(ErrorCodes.PRECONDITION_FAILED, `${contextURL} is blocklisted on Gitpod.`); } // Note: this function does not expect to be awaited for by its caller. This means that it takes care of error handling itself.