/** * Custom error classes for the DagEngine * * Provides structured error handling with error codes and typed details. * All errors extend DagEngineError for consistent error handling. * * @module shared/errors * * @example Catching specific errors * ```typescript * try { * await engine.process(sections); * } catch (error) { * if (error instanceof CircularDependencyError) { * console.log('Cycle:', error.cycle); * } else if (error instanceof DimensionTimeoutError) { * console.log('Timed out:', error.dimension); * } * } * ``` */ /** * Base error class for all DagEngine errors * * Provides structured error information with error codes and optional details. * All custom errors extend this class. */ export declare class DagEngineError extends Error { /** Error code for programmatic handling */ readonly code: string; /** Optional additional error details */ readonly details?: unknown; constructor(message: string, code: string, details?: unknown); } /** * Error thrown when engine configuration is invalid * * @example * ```typescript * // Missing plugin * throw new ConfigurationError('DagEngine requires a plugin'); * * // Invalid concurrency * throw new ConfigurationError('Concurrency must be at least 1', { * provided: 0, * minimum: 1 * }); * ``` */ export declare class ConfigurationError extends DagEngineError { constructor(message: string, details?: unknown); } /** * Error thrown when no providers are configured */ export declare class NoProvidersError extends ConfigurationError { constructor(message?: string); } /** * Error thrown when no sections are provided for processing */ export declare class NoSectionsError extends ConfigurationError { constructor(message?: string); } /** * Error thrown when circular dependencies are detected * * @example * ```typescript * // Detected cycle: A → B → C → A * throw new CircularDependencyError(['A', 'B', 'C', 'A']); * ``` */ export declare class CircularDependencyError extends DagEngineError { /** The cycle path showing the circular dependency */ readonly cycle: string[]; constructor(cycle: string[]); } /** * Error thrown when dependencies fail and continueOnError is false * * Provides structured information about which dependencies failed and why, * making it easy to trace root causes and handle errors programmatically. */ export declare class DependencyError extends DagEngineError { /** The dimension whose dependencies failed */ readonly dimension: string; /** Structured list of failed dependencies with their error messages */ readonly failedDependencies: Array<{ name: string; error: string; }>; constructor(dimension: string, failedDeps: Record); } /** * Error thrown when a dependency is not found */ export declare class DependencyNotFoundError extends DagEngineError { /** The dependency that was not found */ readonly dependency: string; constructor(dependency: string, context: "plugin" | "global" | "section"); } /** * Error thrown when a dimension execution times out */ export declare class DimensionTimeoutError extends DagEngineError { /** The dimension that timed out */ readonly dimension: string; /** The timeout value in milliseconds */ readonly timeout: number; constructor(dimension: string, timeout: number); } /** * Error thrown when execution groups cannot be created * * This typically indicates a circular dependency or invalid graph state. */ export declare class ExecutionGroupingError extends DagEngineError { /** Dimensions that could not be grouped */ readonly stuck: string[]; constructor(stuck: string[], details?: unknown); } /** * Error thrown when a provider is not found */ export declare class ProviderNotFoundError extends DagEngineError { /** The provider that was requested */ readonly provider: string; /** List of available providers */ readonly available: string[]; constructor(provider: string, available: string[]); } /** * Error thrown when all providers fail for a dimension */ export declare class AllProvidersFailed extends DagEngineError { /** The dimension that failed */ readonly dimension: string; /** List of providers that were tried */ readonly providers: string[]; /** The last error that occurred */ readonly lastError: Error; constructor(dimension: string, providers: string[], lastError: Error); } /** * Error thrown when validation fails */ export declare class ValidationError extends DagEngineError { /** The field that failed validation */ readonly field?: string; constructor(message: string, field?: string, details?: unknown); private static buildDetails; } /** * Type guard to check if an error is a DagEngineError */ export declare function isDagEngineError(error: unknown): error is DagEngineError; /** * Normalize any error to a proper Error instance */ export declare function normalizeError(error: unknown): Error; /** * Extract error message safely from any error type */ export declare function getErrorMessage(error: unknown): string; /** * Create an error with context information */ export declare function createContextError(baseError: Error, context: string, details?: unknown): DagEngineError; //# sourceMappingURL=errors.d.ts.map