import { $brands, $cause, $code, $meta, $namespace, $severity, $tags } from '#symbols'; import type { JsonObject } from 'type-fest'; export type Severity = 'fatal' | 'error' | 'warning' | 'info' | 'debug'; export interface XceptionOptions = Record> { /** upstream error */ cause?: unknown; /** error namespace */ namespace?: string; /** context where the error occur */ meta?: Meta; /** additional associations for the error */ tags?: string[]; /** error severity */ severity?: Severity; /** machine-readable error code */ code?: number | string; } export interface FromJSONOptions { /** custom factory for producing subclasses */ reviver?: (json: JsonObject, defaults: XceptionOptions) => Xception | undefined; /** max cause chain depth */ maxDepth?: number; } declare const XCEPTION: unique symbol; /** a high-order error that combine previous stack and tags */ export declare class Xception = Record> extends Error { [XCEPTION]: boolean; /** upstream error */ protected [$cause]?: unknown; /** error namespace */ protected [$namespace]?: string; /** running context */ protected [$meta]: Meta; /** additional associations */ protected [$tags]: string[]; /** error severity */ protected [$severity]: Severity; /** machine-readable error code */ protected [$code]?: number | string; /** * @param message error message * @param options additional options for the error */ constructor(message: string, options?: XceptionOptions); /** get the upstream error */ get cause(): unknown; /** get the error namespace */ get namespace(): string | undefined; /** get the running context */ get meta(): Meta; /** get the additional associations */ get tags(): string[]; /** get the error severity */ get severity(): Severity; /** get the machine-readable error code */ get code(): number | string | undefined; /** * determine whether a value should be treated as an Xception instance * @param instance the value to test * @returns whether the value carries the Xception marker symbol */ static [Symbol.hasInstance](instance: unknown): instance is Xception; /** * reconstruct an Xception instance from a serialized json object * @param json the serialized error payload * @param options reviver and recursion controls * @returns the reconstructed error */ static fromJSON(json: JsonObject, options?: FromJSONOptions): Xception; /** * collect all runtime brands attached to this error * @returns the internal brand chain for this instance */ [$brands](): string[]; /** * convert the error to a jsonifiable object * @returns a jsonifiable object */ toJSON(): JsonObject; } export {}; //# sourceMappingURL=base.d.ts.map