Skip to content

Commit

Permalink
simplify task run error code enum export
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktrn committed Oct 18, 2024
1 parent 2d84b7c commit 34d9759
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions packages/core/src/v3/schemas/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,30 +77,6 @@ export const TaskRunStringError = z.object({

export type TaskRunStringError = z.infer<typeof TaskRunStringError>;

export const TaskRunErrorCodes = {
COULD_NOT_FIND_EXECUTOR: "COULD_NOT_FIND_EXECUTOR",
COULD_NOT_FIND_TASK: "COULD_NOT_FIND_TASK",
COULD_NOT_IMPORT_TASK: "COULD_NOT_IMPORT_TASK",
CONFIGURED_INCORRECTLY: "CONFIGURED_INCORRECTLY",
TASK_ALREADY_RUNNING: "TASK_ALREADY_RUNNING",
TASK_EXECUTION_FAILED: "TASK_EXECUTION_FAILED",
TASK_EXECUTION_ABORTED: "TASK_EXECUTION_ABORTED",
TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE: "TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE",
TASK_PROCESS_SIGKILL_TIMEOUT: "TASK_PROCESS_SIGKILL_TIMEOUT",
TASK_PROCESS_SIGTERM: "TASK_PROCESS_SIGTERM",
TASK_PROCESS_OOM_KILLED: "TASK_PROCESS_OOM_KILLED",
TASK_PROCESS_MAYBE_OOM_KILLED: "TASK_PROCESS_MAYBE_OOM_KILLED",
TASK_RUN_CANCELLED: "TASK_RUN_CANCELLED",
TASK_OUTPUT_ERROR: "TASK_OUTPUT_ERROR",
HANDLE_ERROR_ERROR: "HANDLE_ERROR_ERROR",
GRACEFUL_EXIT_TIMEOUT: "GRACEFUL_EXIT_TIMEOUT",
TASK_RUN_CRASHED: "TASK_RUN_CRASHED",
MAX_DURATION_EXCEEDED: "MAX_DURATION_EXCEEDED",
DISK_SPACE_EXCEEDED: "DISK_SPACE_EXCEEDED",
POD_EVICTED: "POD_EVICTED",
POD_UNKNOWN_ERROR: "POD_UNKNOWN_ERROR",
} as const;

export const TaskRunInternalError = z.object({
type: z.literal("INTERNAL_ERROR"),
code: z.enum([
Expand Down Expand Up @@ -133,6 +109,8 @@ export const TaskRunInternalError = z.object({

export type TaskRunInternalError = z.infer<typeof TaskRunInternalError>;

export const TaskRunErrorCodes = TaskRunInternalError.shape.code.enum;

export const TaskRunError = z.discriminatedUnion("type", [
TaskRunBuiltInError,
TaskRunCustomErrorObject,
Expand Down

0 comments on commit 34d9759

Please sign in to comment.