koa-onerror
Version:
koa error handler, hack ctx.onerror
17 lines (16 loc) • 503 B
TypeScript
export type OnerrorError = Error & {
status: number;
headers?: Record<string, string>;
expose?: boolean;
};
export type OnerrorHandler = (err: OnerrorError, ctx: any) => void;
export type OnerrorOptions = {
text?: OnerrorHandler;
json?: OnerrorHandler;
html?: OnerrorHandler;
all?: OnerrorHandler;
js?: OnerrorHandler;
redirect?: string | null;
accepts?: (...args: string[]) => string;
};
export declare function onerror(app: any, options?: OnerrorOptions): any;