/** * Rich Error Formatting for binja * * Provides detailed error messages with: * - Source code context (snippet) * - Caret pointer to exact location * - "Did you mean?" suggestions * - ANSI colors for terminal output */ export interface ErrorLocation { line: number; column: number; source?: string; templateName?: string; } export interface ErrorOptions extends ErrorLocation { suggestion?: string; availableOptions?: string[]; } /** * Base template error with rich formatting */ export declare class TemplateError extends Error { line: number; column: number; source?: string; templateName?: string; suggestion?: string; availableOptions?: string[]; constructor(message: string, options: ErrorOptions); } /** * Syntax errors (lexer/parser) */ export declare class TemplateSyntaxError extends Error { line: number; column: number; source?: string; templateName?: string; suggestion?: string; constructor(message: string, options: ErrorOptions); } /** * Runtime errors (undefined variables, filter errors) */ export declare class TemplateRuntimeError extends Error { line: number; column: number; source?: string; templateName?: string; suggestion?: string; availableOptions?: string[]; constructor(message: string, options: ErrorOptions); } /** * Find similar string (for "Did you mean?" suggestions) * Uses Levenshtein distance */ export declare function findSimilar(input: string, candidates: string[], maxDistance?: number): string | null; /** * Helper to create errors with source context */ export declare function createSyntaxError(message: string, line: number, column: number, source?: string, suggestion?: string): TemplateSyntaxError; export declare function createRuntimeError(message: string, line: number, column: number, source?: string, suggestion?: string, availableOptions?: string[]): TemplateRuntimeError; //# sourceMappingURL=index.d.ts.map