Help us shape the future of Go! Take the 2026 Go Developer Survey

errors

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupported = errors.New("endpoint is not supported")
	ErrRateLimit    = errors.New("limit of requests per second reached")

	ErrInternal     = errors.New("internal error")
	ErrInvalid      = errors.New("invalid")
	ErrRecoverable  = errors.New("recoverable")
	ErrDisconnected = Recoverable(errors.New("disconnected"))

	ErrFailedTransaction  = errors.New("failed transaction")
	ErrInvalidTransaction = fmt.Errorf("%w: %w", ErrFailedTransaction, errors.New("invalid"))

	// ErrNotInitialized indicates storage instance was not correctly initialized and contains empty required values.
	ErrNotInitialized = errors.New("storage not initialized")
	// ErrNotFound indicates the resource does not exist.
	ErrNotFound = errors.New("entity not found")
	// ErrDuplicate indicates that the entity can not be stored due to an already existing same entity.
	ErrDuplicate = errors.New("entity duplicate")
	// ErrInvalidRange indicates that the block range provided as start and end height is invalid.
	ErrInvalidRange = fmt.Errorf("%w: %w", ErrInvalid, errors.New("invalid block height range"))
	// ErrOutOfRange indicates the requested height is out of available range
	ErrOutOfRange = fmt.Errorf("%w: %w", ErrInvalid, errors.New("height is out of available range"))
)

Functions

func FailedTransaction

func FailedTransaction(reason string) error

func InvalidTransaction

func InvalidTransaction(err error) error

func Recoverable

func Recoverable(err error) error

func TransactionGasPriceTooLow

func TransactionGasPriceTooLow(gasPrice *big.Int) error

Types

type RevertError

type RevertError struct {
	Reason string // revert reason hex encoded
	// contains filtered or unexported fields
}

RevertError is an API error that encompasses an EVM revert with JSON error code and a binary data blob. We need this custom error type defined because the Geth server implementation expects this type when serialising the error API response.

func NewRevertError

func NewRevertError(revert []byte) *RevertError

NewRevertError creates a revertError instance with the provided revert data.

func (*RevertError) ErrorCode

func (e *RevertError) ErrorCode() int

ErrorCode returns the JSON error code for a revert. See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal

func (*RevertError) ErrorData

func (e *RevertError) ErrorData() interface{}

ErrorData returns the hex encoded revert reason.

Jump to

Keyboard shortcuts

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