UNPKG

@rarible/utils

Version:
19 lines (18 loc) 708 B
import type { ErrorOptions } from "../custom/index.js"; import { CustomError } from "../custom/index.js"; /** * Represents error with the specific code * useful in cases when you have keyed-table of errors */ export declare class CodeError<T = void> extends CustomError<T> { code: number; static UNKNOWN_CODE: number; /** * Parses original unknown error and return CodeError * that will have '.code' property */ static parse(error: unknown): CodeError<void>; static parse<T>(error: unknown, data: T): CodeError<T>; constructor(code: number, message: string | undefined, options?: ErrorOptions<T>); } export declare function extractErrorCode(error: unknown): number;