UNPKG

@bsv/sdk

Version:

BSV Blockchain Software Development Kit

30 lines (24 loc) 678 B
export class WalletError extends Error { code: number isError: boolean = true constructor (message: string, code = 1, stack?: string) { super(message) this.code = code this.name = this.constructor.name if (stack !== undefined && stack !== null && stack !== '') { this.stack = stack } else { Error.captureStackTrace(this, this.constructor) } } } // NOTE: Enum values must not exceed the UInt8 range (0–255) export enum walletErrors { unknownError = 1, unsupportedAction = 2, invalidHmac = 3, invalidSignature = 4, reviewActions = 5, } export type WalletErrorCode = keyof typeof walletErrors export default WalletError