UNPKG

@xec-sh/core

Version:

Universal shell execution engine

57 lines (56 loc) 2.01 kB
import { ExecutionError } from './error.js'; export interface ErrorContext { command?: string; adapter?: string; host?: string; container?: string; pod?: string; cwd?: string; env?: Record<string, string>; timestamp?: Date; duration?: number; } export interface ErrorSuggestion { message: string; command?: string; documentation?: string; } export interface EnhancedErrorDetails { code: string; context: ErrorContext; suggestions: ErrorSuggestion[]; relatedErrors?: string[]; systemInfo?: { platform: string; arch: string; nodeVersion: string; }; } export declare class EnhancedExecutionError extends ExecutionError { readonly context: ErrorContext; readonly suggestions: ErrorSuggestion[]; readonly relatedErrors?: string[]; readonly systemInfo?: any; constructor(message: string, code: string, context?: ErrorContext, suggestions?: ErrorSuggestion[]); addSuggestion(suggestion: ErrorSuggestion): this; format(verbose?: boolean): string; } export declare class EnhancedCommandError extends EnhancedExecutionError { readonly exitCode: number; readonly signal: string | undefined; readonly stdout: string; readonly stderr: string; readonly duration: number; constructor(command: string, exitCode: number, signal: string | undefined, stdout: string, stderr: string, duration: number, adapter?: string); } export declare class EnhancedConnectionError extends EnhancedExecutionError { readonly host: string; readonly originalError: Error; readonly port?: number | undefined; constructor(host: string, originalError: Error, port?: number | undefined, adapter?: string); } export declare class EnhancedTimeoutError extends EnhancedExecutionError { readonly timeout: number; constructor(command: string, timeout: number, adapter?: string); } export declare function enhanceError(error: Error, context?: ErrorContext): EnhancedExecutionError;