Documentation
¶
Overview ¶
Package errors provides typed error types for blockchain wallet and RPC failures in the DOSRouter system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBalanceError ¶
IsBalanceError returns true if err is either InsufficientFundsError or EmptyWalletError.
Types ¶
type EmptyWalletError ¶
type EmptyWalletError struct {
Code string `json:"code"`
WalletAddress string `json:"walletAddress"`
}
EmptyWalletError indicates the wallet has a zero balance.
func IsEmptyWalletError ¶
func IsEmptyWalletError(err error) (*EmptyWalletError, bool)
IsEmptyWalletError reports whether err is an EmptyWalletError.
func NewEmptyWalletError ¶
func NewEmptyWalletError(wallet string) *EmptyWalletError
NewEmptyWalletError creates an EmptyWalletError.
func (*EmptyWalletError) Error ¶
func (e *EmptyWalletError) Error() string
type InsufficientFundsError ¶
type InsufficientFundsError struct {
Code string `json:"code"`
CurrentBalanceUSD float64 `json:"currentBalanceUSD"`
RequiredUSD float64 `json:"requiredUSD"`
WalletAddress string `json:"walletAddress"`
}
InsufficientFundsError indicates the wallet balance is too low for the requested operation.
func IsInsufficientFundsError ¶
func IsInsufficientFundsError(err error) (*InsufficientFundsError, bool)
IsInsufficientFundsError reports whether err is an InsufficientFundsError.
func NewInsufficientFundsError ¶
func NewInsufficientFundsError(wallet string, current, required float64) *InsufficientFundsError
NewInsufficientFundsError creates an InsufficientFundsError.
func (*InsufficientFundsError) Error ¶
func (e *InsufficientFundsError) Error() string
type RpcError ¶
RpcError wraps a low-level RPC failure.
func IsRpcError ¶
IsRpcError reports whether err is an RpcError.
func NewRpcError ¶
NewRpcError creates an RpcError wrapping the original error.