import { PadroneSignal } from "./runtime.mjs"; //#region src/core/errors.d.ts type PadroneErrorOptions = { /** Process exit code. Defaults to 1. */exitCode?: number; /** Actionable suggestions shown to the user (e.g. "Use --env production"). */ suggestions?: string[]; /** The command path that produced the error (e.g. "deploy staging"). */ command?: string; /** The phase where the error occurred. */ phase?: 'parse' | 'validate' | 'execute' | 'config'; /** Original cause for error chaining. */ cause?: unknown; }; /** * Base error class for all Padrone errors. * Carries structured metadata for user-friendly formatting and programmatic handling. * * @example * ```ts * throw new PadroneError('Something went wrong', { * exitCode: 1, * suggestions: ['Try --help for usage information'], * }); * ``` */ declare class PadroneError extends Error { readonly exitCode: number; readonly suggestions: string[]; readonly command?: string; readonly phase?: 'parse' | 'validate' | 'execute' | 'config'; constructor(message: string, options?: PadroneErrorOptions); /** * Returns a serializable representation of the error, * suitable for non-terminal runtimes (web UIs, APIs, etc.). */ toJSON(): { name: string; message: string; exitCode: number; suggestions: string[]; command?: string; phase?: string; }; } /** * Thrown when command routing fails — unknown command, unexpected arguments, etc. */ declare class RoutingError extends PadroneError { constructor(message: string, options?: PadroneErrorOptions); } /** * Thrown when argument or schema validation fails. * Carries the structured issues from the schema validator. */ declare class ValidationError extends PadroneError { readonly issues: readonly { path?: PropertyKey[]; message: string; }[]; constructor(message: string, issues: readonly { path?: PropertyKey[]; message: string; }[], options?: PadroneErrorOptions); toJSON(): { issues: { path: string[] | undefined; message: string; }[]; name: string; message: string; exitCode: number; suggestions: string[]; command?: string; phase?: string; }; } /** * Thrown when config file loading or validation fails. */ declare class ConfigError extends PadroneError { constructor(message: string, options?: PadroneErrorOptions); } /** * Thrown from user action handlers to surface structured errors with exit codes and suggestions. * This is the primary error class users should throw from their command actions. * * @example * ```ts * throw new ActionError('Missing environment', { * exitCode: 1, * suggestions: ['Use --env production or --env staging'], * }); * ``` */ declare class ActionError extends PadroneError { constructor(message: string, options?: PadroneErrorOptions); } /** * Thrown when command execution is interrupted by a process signal (SIGINT, SIGTERM, SIGHUP). * Carries the signal name and the conventional exit code (128 + signal number). */ declare class SignalError extends PadroneError { readonly signal: PadroneSignal; constructor(signal: PadroneSignal, options?: { cause?: unknown; }); } //#endregion export { ActionError, ConfigError, PadroneError, PadroneErrorOptions, RoutingError, SignalError, ValidationError }; //# sourceMappingURL=errors.d.mts.map