@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
79 lines • 2.45 kB
TypeScript
import type { ErrorCode } from './codes';
/**
* Configure error handling behavior
*/
export declare function configureErrorHandling(config: Partial<ErrorConfig>): void;
/**
* Get current error configuration
*/
export declare function getErrorConfig(): ErrorConfig;
/**
* Reset error configuration to defaults
*/
export declare function resetErrorConfig(): void;
/**
* Format file path based on configuration
*/
export declare function formatFilePath(filePath: string): string;
/**
* Error handling configuration
*/
export declare interface ErrorConfig {
showRelativePaths: boolean
baseDir?: string
enableAutoRecovery: boolean
logRecoveryWarnings: boolean
}
/**
* Error context information
*/
export declare interface ErrorContext {
filePath: string
template: string
offset: number
match: string
}
/**
* Base STX error class
*/
export declare class StxError extends Error {
numericCode: ErrorCode;
public code: string;
public filePath?: string;
public line?: number;
public column?: number;
public context?: string;
constructor(message: string, code: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}
/**
* Syntax error in template
*/
export declare class StxSyntaxError extends StxError {
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}
/**
* Runtime error during template processing
*/
export declare class StxRuntimeError extends StxError {
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}
/**
* Security-related error
*/
export declare class StxSecurityError extends StxError {
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}
/**
* File operation error
*/
export declare class StxFileError extends StxError {
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}
/**
* Validation error - these are ALWAYS fatal and cannot be recovered from.
* Used for enforcing coding standards like prohibited DOM API usage.
*/
export declare class StxValidationError extends StxError {
readonly isFatal: boolean;
constructor(message: string, filePath?: string, line?: number, column?: number, context?: string, numericCode?: ErrorCode);
}