@bitblit/ratchet-warden-common
Version:
Typescript library to simplify using simplewebauthn and secondary auth methods over GraphQL
30 lines (29 loc) • 1.29 kB
TypeScript
export declare class WardenError<T = void> extends Error {
private static readonly WARDEN_ERROR_FLAG_KEY;
private _errorCode;
private _internalMessage;
private _publicMessage;
private _details;
private _wrappedError;
constructor(code: number, internalMessage?: string, publicMessage?: string, wrapped?: Error, details?: T);
withFormattedInternalErrorMessage(format: string, ...input: any[]): WardenError<T>;
setFormattedInternalErrorMessage(format: string, ...input: any[]): void;
withFormattedPublicErrorMessage(format: string, ...input: any[]): WardenError<T>;
setFormattedPublicErrorMessage(format: string, ...input: any[]): void;
withErrorCode(code: number): WardenError<T>;
withDetails(details: T): WardenError<T>;
withWrappedError(err: Error): WardenError<T>;
isWrappedError(): boolean;
static wrapError<T = void>(err: Error): WardenError<T>;
static objectIsWardenError(obj: any): boolean;
get errorCode(): number;
set errorCode(value: number);
get publicMessage(): string;
set publicMessage(value: string);
get internalMessage(): string;
set internalMessage(value: string);
get details(): T;
set details(value: T);
get wrappedError(): Error;
set wrappedError(value: Error);
}