import type es from 'estree'; import type { Node } from '../types'; export declare enum ErrorType { IMPORT = "Import", RUNTIME = "Runtime", SYNTAX = "Syntax", TYPE = "Type" } export declare enum ErrorSeverity { WARNING = "Warning", ERROR = "Error" } export interface SourceError { readonly type: ErrorType; readonly severity: ErrorSeverity; location: es.SourceLocation; explain(): string; elaborate(): string; } /** * Abstract Source Error class that automatically handles its location property */ export declare abstract class SourceErrorWithNode extends Error implements SourceError { node: T; constructor(node: T); get location(): es.SourceLocation; abstract readonly type: ErrorType; abstract readonly severity: ErrorSeverity; abstract explain(): string; abstract elaborate(): string; get message(): string; } /** * Abstract Source Error class for Runtime errors */ export declare abstract class RuntimeSourceError extends SourceErrorWithNode { type: ErrorType; severity: ErrorSeverity; elaborate(): string; } /** * A concrete instantiation of {@link RuntimeSourceError} that can * be used when there just aren't any other good Source error classes that can be used */ export declare class GeneralRuntimeError extends RuntimeSourceError { private readonly explanation; private readonly elaboration?; constructor(explanation: string, node?: es.BaseNode, elaboration?: string | undefined); explain(): string; elaborate(): string; } /** * A subclass of {@link RuntimeSourceError} intended for use when an unexpected runtime error * occurs due to an internal error rather than any error caused by the code being evaluated. */ export declare class InternalRuntimeError extends RuntimeSourceError { private readonly explanation; private readonly elaboration?; constructor(explanation: string, node?: T, elaboration?: string | undefined); explain(): string; elaborate(): string; }