UNPKG

@aradox/multi-orm

Version:

Type-safe ORM with multi-datasource support, row-level security, and Prisma-like API for PostgreSQL, SQL Server, and HTTP APIs

86 lines 2.42 kB
/** * Parser Error Handling Module * * Provides structured error reporting with source locations (file, line, column) * and optional suggestions for fixes. */ export interface SourceLocation { file: string; line: number; column: number; length?: number; } export interface ParserError { message: string; location: SourceLocation; severity: 'error' | 'warning'; suggestion?: string; code?: string; } /** * Custom error class for parser errors with source locations */ export declare class DSLParserError extends Error { readonly location: SourceLocation; readonly severity: 'error' | 'warning'; readonly suggestion?: string; readonly code?: string; constructor(message: string, location: SourceLocation, options?: { severity?: 'error' | 'warning'; suggestion?: string; code?: string; }); /** * Format error for display with source context */ format(sourceLines?: string[]): string; /** * Convert to JSON for structured error reporting */ toJSON(): ParserError; } /** * Collection of parser errors that can accumulate multiple issues */ export declare class ParserErrorCollection extends Error { readonly errors: DSLParserError[]; constructor(errors: DSLParserError[]); /** * Format all errors for display */ format(sourceLines?: string[]): string; /** * Check if collection contains any errors (not just warnings) */ hasErrors(): boolean; /** * Convert to JSON for structured error reporting */ toJSON(): ParserError[]; } /** * Helper function to create a parser error */ export declare function createParserError(message: string, location: SourceLocation, options?: { severity?: 'error' | 'warning'; suggestion?: string; code?: string; }): DSLParserError; /** * Token with source location information */ export interface Token { type: string; value: string; location: SourceLocation; } /** * Helper to calculate column position in original source * Handles trimmed lines by finding the first non-whitespace character */ export declare function calculateColumn(originalLine: string, trimmedLine: string): number; /** * Helper to find token position within a line */ export declare function findTokenColumn(line: string, token: string, startOffset?: number): number; //# sourceMappingURL=errors.d.ts.map