import * as Effect from "effect/Effect"; import { AppError } from "../app-error/index.js"; import type { OutputFormat } from "./output-mode.js"; import { type Doc } from "../screen/index.js"; /** * Classified error result — pure data describing what handleError should do. * * `stderr` holds the lines to write to stderr in order (human text in text * mode; NDJSON event lines in json mode). `stdout` is the final structured * document (json mode only). Both are optional — usage/help-only errors emit * neither. */ export interface ErrorClassification { readonly exitCode: number; readonly stderr?: ReadonlyArray; readonly stderrDoc?: Doc; readonly stdout?: string; } /** * Channel outputs for a handled `AppError` — the single source of truth for how * an AppError appears across surfaces, shared by the outer * (`classifyError`/`handleError`) and inner (`writeExpectedCliError`) error * paths so the two cannot drift: * - text: human-readable `renderAppError` (including its single `Next:` * block) on stderr. * - json: NDJSON `suggestion` events followed by the `error` event on stderr * (the live stream, mirroring the success renderer), plus the structured * envelope (which also carries the suggestions) on stdout. * * Suggestions appear once per channel: the stderr stream and the stdout * envelope are distinct surfaces, never a doubled block on the same one. */ export declare const renderAppErrorChannels: (error: AppError, format: OutputFormat, options?: { readonly verbose: boolean; readonly debug: boolean; }) => { readonly stderr: ReadonlyArray; readonly stderrDoc?: Doc; readonly stdout?: string; }; /** * Pure error classification — determines exit code and output without side effects. * * Channel routing per format: * - text: human-readable to stderr only (no stdout pollution) * - json: typed error JSON to stdout + NDJSON error event to stderr * Exit codes: * - ShowHelp (no errors) → 0 (help successfully displayed) * - ShowHelp (with errors) → 2 (usage — help shown due to invocation error) * - EffectCliExit → custom exit code * - CliError → 2 (usage/validation — bad flags, missing args) * - Other → 10 (unexpected internal error) */ export declare const classifyError: (error: unknown, format: OutputFormat, options?: { readonly verbose: boolean; readonly debug: boolean; }) => ErrorClassification; /** * Error routing based on output mode. * * Classifies the error, writes its stderr lines and optional stdout document, * and exits. */ export declare const handleError: (error: unknown, format: OutputFormat) => Effect.Effect; //# sourceMappingURL=handle-error.d.ts.map