/** * Harness error base with a stable machine-routable code and chained cause. * Package errors extend it so tool results and replay can retain failure class. * @module @deepseek-ai/dsh-error */ /** * Base class for all harness errors. Carries a `code` (stable, programmatic — * e.g. `NO_ADAPTER`, `INVALID_ARGS`) distinct from the * human-readable `message`, and supports `cause` chaining via the standard * `ErrorOptions`. `name` defaults to the subclass constructor name. */ export class HarnessError extends Error { /** Stable machine-routable failure class (e.g. `RATE_LIMIT`); route on this, never by parsing `message`. */ readonly code: string constructor(message: string, code: string, options?: ErrorOptions) { super(message, options) this.code = code this.name = new.target.name } }