Skip to content

Commit

Permalink
Use proper error code when repo is blocked (#19600)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 authored Apr 4, 2024
1 parent d1fc093 commit 949af13
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GitpodServer.StartWorkspaceOptions, "ideSettings"> {
excludeFeatureFlags?: NamedWorkspaceFeatureFlag[];
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 949af13

Please sign in to comment.