import { OnerrorError } from "./onerror.js"; import { StackFrame } from "stack-trace"; import { Context } from "egg"; //#region src/lib/error_view.d.ts export interface FrameSource { pre: string[]; line: string; post: string[]; } export interface Frame extends StackFrame { context?: FrameSource; } export declare class ErrorView { ctx: Context; error: OnerrorError; request: Context["request"]; app: Context["app"]; assets: Map; viewTemplate: string; codeContext: number; _filterHeaders: string[]; constructor(ctx: Context, error: OnerrorError, template: string); /** * get html error page * * @return {String} html page */ toHTML(): string; /** * compile view * * @param {String} tpl - template * @param {Object} locals - data used by template */ compileView(tpl: string, locals: Record): string; /** * check if the frame is node native file. * * @param {Frame} frame - current frame */ isNode(frame: Frame): boolean; /** * check if the frame is app modules. * * @param {Object} frame - current frame */ isApp(frame: Frame): boolean; /** * cache file asserts * * @param {String} key - assert key * @param {String} value - assert content */ setAssets(key: string, value: string): void; /** * get cache file asserts * * @param {String} key - assert key */ getAssets(key: string): string | undefined; /** * get frame source * * @param {Object} frame - current frame */ getFrameSource(frame: StackFrame): FrameSource; /** * parse error and return frame stack */ parseError(): Frame[]; /** * get stack context * * @param {Object} frame - current frame */ getContext(frame: Frame): { start?: number; pre?: string; line?: string; post?: string; }; /** * get frame classes, let view identify the frame * * @param {any} frame - current frame * @param {any} index - current index */ getFrameClasses(frame: Frame, index: number): string; /** * serialize frame and return meaningful data * * @param {Object} frame - current frame */ serializeFrame(frame: Frame): { extname: string; file: string; method: string | null; line: number | null; column: number | null; context: { start?: number; pre?: string; line?: string; post?: string; }; classes: string; }; /** * serialize base data * * @param {Object} stack - frame stack * @param {Function} frameFormatter - frame formatter function */ serializeData(stack: Frame[], frameFormatter: (frame: Frame, index: number) => any): { code: any; message: string; name: string; status: number | undefined; frames: any[]; }; /** * serialize request object */ serializeRequest(): { url: string; httpVersion: string; method: string; connection: string | string[] | undefined; headers: { key: string; value: string | string[] | undefined; }[]; cookies: { key: string; value: string | undefined; }[]; }; /** * serialize app info object */ serializeAppInfo(): { baseDir: string; config: string; }; serializeConfig(): unknown; getConfigIgnoreList(): (string | RegExp)[]; redactConfig(value: unknown, ignoreList: (string | RegExp)[], ancestors?: WeakSet): unknown; shouldRedactConfigKey(key: string, ignoreList: (string | RegExp)[]): boolean; } //#endregion