block-quote On this pagechevron-down
GitBook Assistant Ask chevron-down @bsv/simple chevron-right @bsv/simple Overview chevron-right API Reference Errors @bsv/simple provides a hierarchy of error classes for domain-specific error handling. All errors extend the base SimpleError.
Source: src/core/errors.ts
Error Hierarchy
Copy SimpleError (base)
├── WalletError
├── TransactionError
├── MessageBoxError
├── CertificationError
├── DIDError
└── CredentialError Base class for all library errors.
Copy class SimpleError extends Error {
code ?: string
constructor ( message : string , code ?: string )
} Wallet initialization and connection errors.
Example triggers:
Failed to connect to wallet extension
TransactionError
Transaction creation and signing errors.
Example triggers:
MessageBoxError
MessageBox P2P messaging errors.
Example triggers:
Failed to anoint MessageBox host
Payment send/receive failures
Identity registry communication errors
CertificationError
Certificate issuance and management errors.
Example triggers:
Certificate issuance fails
Certificate acquisition from remote server fails
DID parsing and registration errors.
Example triggers:
Invalid DID format (not did:bsv: prefix)
Invalid identity key in DID string
CredentialError
Verifiable Credential errors.
Example triggers:
Revocation enabled but no wallet provided
Revocation UTXO creation failure
Certificate already revoked
Catching Errors
Note on Module Errors
Many module methods (tokens, inscriptions, messagebox, overlay) wrap errors in plain Error instances with descriptive prefixes rather than using the typed error classes:
The typed error classes (DIDError, CredentialError) are used primarily by the DID and credentials modules. You can catch these specifically or catch the generic Error type for other modules.