/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ /** * Domain error types for e3-core. * * All e3 errors extend E3Error, allowing callers to catch all domain errors * with `if (err instanceof E3Error)` or specific errors with their class. */ import type { TaskExecutionResult } from './dataflow.js'; /** Base class for all e3 errors */ export declare class E3Error extends Error { constructor(message: string); } /** * Thrown when a repository is not found. * Used by StorageBackend.validateRepository() and RepoStore operations. */ export declare class RepoNotFoundError extends E3Error { readonly repo: string; constructor(repo: string); } /** * Thrown when attempting to create a repository that already exists. */ export declare class RepoAlreadyExistsError extends E3Error { readonly repo: string; constructor(repo: string); } /** * Thrown when a repository status doesn't match the expected value. * Used for CAS (compare-and-swap) operations. */ export declare class RepoStatusConflictError extends E3Error { readonly repo: string; readonly expected: string | string[]; readonly actual: string | 'not_found'; constructor(repo: string, expected: string | string[], actual: string | 'not_found'); } export declare class WorkspaceNotFoundError extends E3Error { readonly workspace: string; constructor(workspace: string); } export declare class WorkspaceNotDeployedError extends E3Error { readonly workspace: string; constructor(workspace: string); } export declare class WorkspaceExistsError extends E3Error { readonly workspace: string; constructor(workspace: string); } /** * Information about a lock holder for error display. * * This is a simplified flat structure used in error messages. * The actual lock state uses the structured LockState type from e3-types. */ export interface LockHolderInfo { /** Process ID of the lock holder (for local process locks) */ pid?: number; /** When the lock was acquired (ISO 8601) */ acquiredAt: string; /** What operation holds the lock */ operation?: string; /** System boot ID (to detect stale locks after reboot) */ bootId?: string; /** Process start time in jiffies (to detect PID reuse) */ startTime?: number; /** Command that acquired the lock (for debugging) */ command?: string; } /** * Thrown when a workspace is locked by another process. * * This error is thrown when attempting to acquire an exclusive lock on a * workspace that is already locked by another process (e.g., another * `e3 start` command or API server). */ export declare class WorkspaceLockError extends E3Error { readonly workspace: string; readonly holder?: LockHolderInfo | undefined; constructor(workspace: string, holder?: LockHolderInfo | undefined); } export declare class PackageNotFoundError extends E3Error { readonly packageName: string; readonly version?: string | undefined; constructor(packageName: string, version?: string | undefined); } export declare class PackageInvalidError extends E3Error { readonly reason: string; constructor(reason: string); } export declare class PackageExistsError extends E3Error { readonly packageName: string; readonly version: string; constructor(packageName: string, version: string); } export declare class DatasetNotFoundError extends E3Error { readonly workspace: string; readonly path: string; constructor(workspace: string, path: string); } /** * Thrown by {@link DatasetRefStore.writeIf} when the stored revision no longer * matches the expected one — another writer committed in between. * * Callers performing a compare-and-swap (read revision, compute, conditional * write) catch this to re-read and retry. This is the primitive that closes the * lost-update window in the blind `e3 set` / `Data.write` path. */ export declare class DatasetRefConflictError extends E3Error { readonly workspace: string; readonly path: string; readonly expectedRevision: string | null; readonly actualRevision: string | null; constructor(workspace: string, path: string, expectedRevision: string | null, actualRevision: string | null); } export declare class TaskNotFoundError extends E3Error { readonly task: string; constructor(task: string); } export declare class ObjectNotFoundError extends E3Error { readonly hash: string; constructor(hash: string); } export declare class ObjectCorruptError extends E3Error { readonly hash: string; readonly reason: string; constructor(hash: string, reason: string); } export declare class ExecutionCorruptError extends E3Error { readonly taskHash: string; readonly inputsHash: string; readonly cause: Error; constructor(taskHash: string, inputsHash: string, cause: Error); } export declare class ExecutionNotFoundError extends E3Error { readonly task: string; constructor(task: string); } export declare class DataflowError extends E3Error { readonly taskResults?: TaskExecutionResult[] | undefined; readonly cause?: Error | undefined; constructor(message: string, taskResults?: TaskExecutionResult[] | undefined, cause?: Error | undefined); } /** * Thrown when a dataflow execution is aborted via AbortSignal. * * This is not an error condition - it indicates the execution was intentionally * cancelled (e.g., by an API server before applying a write). The partial * results contain the status of tasks that completed before the abort. */ export declare class DataflowAbortedError extends E3Error { readonly partialResults?: TaskExecutionResult[] | undefined; constructor(partialResults?: TaskExecutionResult[] | undefined); } export declare class PermissionDeniedError extends E3Error { readonly path: string; constructor(path: string); } /** Check if error is ENOENT (file not found) */ export declare function isNotFoundError(err: unknown): boolean; /** Check if error is EACCES (permission denied) */ export declare function isPermissionError(err: unknown): boolean; /** Check if error is EEXIST (already exists) */ export declare function isExistsError(err: unknown): boolean; /** Wrap unknown errors with context */ export declare function wrapError(err: unknown, message: string): E3Error; //# sourceMappingURL=errors.d.ts.map