wallet-storage-client
Version:
Client only Wallet Storage
45 lines • 1.92 kB
TypeScript
import { ErrorCodeString10To40Bytes, ErrorDescriptionString20To200Bytes, WalletErrorObject } from '@bsv/sdk';
/**
* Derived class constructors should use the derived class name as the value for `name`,
* and an internationalizable constant string for `message`.
*
* If a derived class intends to wrap another WalletError, the public property should
* be named `walletError` and will be recovered by `fromUnknown`.
*
* Optionaly, the derived class `message` can include template parameters passed in
* to the constructor. See WERR_MISSING_PARAMETER for an example.
*
* To avoid derived class name colisions, packages should include a package specific
* identifier after the 'WERR_' prefix. e.g. 'WERR_FOO_' as the prefix for Foo package error
* classes.
*/
export declare class WalletError extends Error implements WalletErrorObject {
details?: Record<string, string> | undefined;
isError: true;
constructor(name: string, message: string, stack?: string, details?: Record<string, string> | undefined);
/**
* Error class compatible accessor for `code`.
*/
get code(): ErrorCodeString10To40Bytes;
set code(v: ErrorCodeString10To40Bytes);
/**
* Error class compatible accessor for `description`.
*/
get description(): ErrorDescriptionString20To200Bytes;
set description(v: ErrorDescriptionString20To200Bytes);
/**
* Recovers all public fields from WalletError derived error classes and relevant Error derived errors.
*
* Critical client data fields are preserved across HTTP DojoExpress / DojoExpressClient encoding.
*/
static fromUnknown(err: unknown): WalletError;
/**
* @returns standard HTTP error status object with status property set to 'error'.
*/
asStatus(): {
status: string;
code: string;
description: string;
};
}
//# sourceMappingURL=WalletError.d.ts.map