UNPKG

@xec-sh/cli

Version:

Xec: The Universal Shell for TypeScript

51 lines (50 loc) 2.37 kB
import { ValidationError } from './validation.js'; import { CommandOptions } from './command-base.js'; export interface ErrorDetails { code?: string; field?: string; suggestion?: string; documentation?: string; } export declare class XecError extends Error { code?: string | undefined; details?: ErrorDetails | undefined; constructor(message: string, code?: string | undefined, details?: ErrorDetails | undefined); } export declare class ConfigurationError extends XecError { constructor(message: string, field?: string, suggestion?: string); } export declare class ModuleError extends XecError { constructor(message: string, moduleName?: string, suggestion?: string); } export declare class TaskError extends XecError { constructor(message: string, taskName?: string, suggestion?: string); } export declare class RecipeError extends XecError { constructor(message: string, recipeName?: string, suggestion?: string); } export declare class NetworkError extends XecError { constructor(message: string, url?: string, suggestion?: string); } export declare class FileSystemError extends XecError { constructor(message: string, path?: string, suggestion?: string); } export declare class TimeoutError extends XecError { constructor(message: string, operation?: string, suggestion?: string); } export declare function handleError(error: any, options: CommandOptions): void; export declare function withErrorHandling<T extends any[], R>(fn: (...args: T) => Promise<R>, options: CommandOptions): (...args: T) => Promise<R>; export declare function createContextError(message: string, context: string, suggestion?: string): XecError; export declare const errorMessages: { fileNotFound: (path: string) => FileSystemError; directoryNotFound: (path: string) => FileSystemError; moduleNotFound: (name: string) => ModuleError; taskNotFound: (name: string) => TaskError; recipeNotFound: (name: string) => RecipeError; configurationInvalid: (field: string, reason: string) => ConfigurationError; networkTimeout: (url: string) => NetworkError; permissionDenied: (path: string) => FileSystemError; operationFailed: (operation: string, reason: string) => XecError; resourceNotFound: (resource: string) => XecError; invalidInput: (field: string, reason: string) => ValidationError; };