Component evidence

Task Engine Error Types (task-engine/errors.ts)

the-engineer · src/core/task-engine/errors.ts · typescript · MIT
automationdev-toolslang:typescripttag:error-handlingtag:domaintag:task-enginetag:validation

Defines discriminated custom error classes for the task engine, covering not‑found, invalid transitions, version conflicts, and unknown fields, enabling precise error handling and retry logic.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/FarzamMohammadi/the-engineer | License: MIT | Copyright 2026 Farzam Mohammadi
// Provided via justclaw.it.com; keep this notice with the code.
/** Base class for all task-engine errors. Tagged for discriminated matching. */
export abstract class TaskEngineError extends Error {
  abstract readonly tag: string;
  abstract readonly retryable: boolean;
}

/** Task was not found by ID. */
export class TaskNotFoundError extends TaskEngineError {
  readonly tag = "TaskNotFound" as const;
  readonly retryable = false;
  readonly taskId: string;

  constructor(taskId: string) {
    super(`Task "${taskId}" not found`);
    this.name = "TaskNotFoundError";
    this.taskId = taskId;
  }
}

/** State transition is not valid per the state machine. */
export class InvalidTra

... (truncated -- full source via MCP)