errors

package
v0.12.199-go Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 2 Imported by: 0

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

func IsBalanceError(err error) bool

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

type RpcError struct {
	Code          string `json:"code"`
	OriginalError error  `json:"-"`
}

RpcError wraps a low-level RPC failure.

func IsRpcError

func IsRpcError(err error) (*RpcError, bool)

IsRpcError reports whether err is an RpcError.

func NewRpcError

func NewRpcError(original error) *RpcError

NewRpcError creates an RpcError wrapping the original error.

func (*RpcError) Error

func (e *RpcError) Error() string

func (*RpcError) Unwrap

func (e *RpcError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL