/** * Error Formatter * * Self-contained formatters for RillError display. * Produces human-readable and JSON error output with: * - Error header (code + message) * - Primary source snippet with caret * - Call stack frames with source snippets * * Rendering helpers are grouped here so a future colorizer can * wrap or replace individual render functions without touching * the layout logic. */ import type { RillError } from './types.js'; /** Source texts keyed by origin (script body, generated bindings, etc.) */ export type SourceMap = { script?: string; bindings?: string; }; /** Options for the human-readable error formatter. */ export interface FormatErrorOptions { readonly verbose?: boolean; readonly maxStackDepth?: number; readonly filePath?: string; readonly sources?: SourceMap; } /** * Format a RillError for human-readable terminal output. * * Output structure: * ``` * error[RILL-R001]: file not found: test.txta * at script.rill:5:10 * * 5 | |path| { $read("data", $path) } => $moar_reader * | ^ * * called from: * 10 | $reader("test.txta") * | ^ * ``` */ export declare function formatRillError(error: RillError, options?: FormatErrorOptions): string; /** Options for the JSON error formatter. */ export interface FormatErrorJsonOptions { readonly maxStackDepth?: number; readonly filePath?: string; } /** * Format a RillError as a machine-readable JSON string. * * Output includes errorId, message, location, context, helpUrl, * and callStack (when frames are present). */ export declare function formatRillErrorJson(error: RillError, options?: FormatErrorJsonOptions): string;