errors

package
v0.0.0-...-46a0b90 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Errors contains all errors that could be returned
	// by this Rosetta implementation.
	Errors = []*types.Error{
		ErrUnimplemented,
		ErrUnavailableOffline,
		ErrGeth,
		ErrUnableToDecompressPubkey,
		ErrUnclearIntent,
		ErrUnableToParseIntermediateResult,
		ErrInvalidSignature,
		ErrBroadcastFailed,
		ErrCallParametersInvalid,
		ErrCallOutputMarshal,
		ErrCallMethodInvalid,
		ErrBlockOrphaned,
		ErrInvalidAddress,
		ErrGethNotReady,
		ErrInvalidNonce,
		ErrFetchFunctionSignatureMethodID,
		ErrInvalidTokenContractAddress,
	}

	// ErrUnimplemented is returned when an endpoint
	// is called that is not implemented.
	ErrUnimplemented = &types.Error{
		Code:    0,
		Message: "Endpoint not implemented",
	}

	// ErrUnavailableOffline is returned when an endpoint
	// is called that is not available offline.
	ErrUnavailableOffline = &types.Error{
		Code:    1,
		Message: "Endpoint unavailable offline",
	}

	// ErrGeth is returned when geth
	// errors on a request.
	ErrGeth = &types.Error{
		Code:    2,
		Message: "geth error",
	}

	// ErrUnableToDecompressPubkey is returned when
	// the *types.PublicKey provided in /construction/derive
	// cannot be decompressed.
	ErrUnableToDecompressPubkey = &types.Error{
		Code:    3,
		Message: "unable to decompress public key",
	}

	// ErrUnclearIntent is returned when operations
	// provided in /construction/preprocess or /construction/payloads
	// are not valid.
	ErrUnclearIntent = &types.Error{
		Code:    4,
		Message: "Unable to parse intent",
	}

	// ErrUnableToParseIntermediateResult is returned
	// when a data structure passed between Construction
	// API calls is not valid.
	ErrUnableToParseIntermediateResult = &types.Error{
		Code:    5,
		Message: "Unable to parse intermediate result",
	}

	// ErrInvalidSignature is returned when a signature
	// cannot be parsed.
	ErrInvalidSignature = &types.Error{
		Code:    6,
		Message: "Signature invalid",
	}

	// ErrBroadcastFailed is returned when transaction
	// broadcast fails.
	ErrBroadcastFailed = &types.Error{
		Code:    7,
		Message: "Unable to broadcast transaction",
	}

	// ErrCallParametersInvalid is returned when
	// the parameters for a particular call method
	// are considered invalid.
	ErrCallParametersInvalid = &types.Error{
		Code:    8,
		Message: "Call parameters invalid",
	}

	// ErrCallOutputMarshal is returned when the output
	// for /call cannot be marshaled.
	ErrCallOutputMarshal = &types.Error{
		Code:    9,
		Message: "Call output marshal failed",
	}

	// ErrCallMethodInvalid is returned when a /call
	// method is invalid.
	ErrCallMethodInvalid = &types.Error{
		Code:    10,
		Message: "Call method invalid",
	}

	// ErrBlockOrphaned is returned when a block being
	// processed is orphaned and it is not possible
	// to gather all receipts. At some point in the future,
	// it may become possible to gather all receipts if the
	// block becomes part of the canonical chain again.
	ErrBlockOrphaned = &types.Error{
		Code:      11,
		Message:   "Block orphaned",
		Retriable: true,
	}

	// ErrInvalidAddress is returned when an address
	// is not valid.
	ErrInvalidAddress = &types.Error{
		Code:    12,
		Message: "Invalid address",
	}

	// ErrGethNotReady is returned when geth
	// cannot yet serve any queries.
	ErrGethNotReady = &types.Error{
		Code:      13,
		Message:   "geth not ready",
		Retriable: true,
	}

	// ErrInvalidNonce is returned when input nonce
	// is invalid.
	ErrInvalidNonce = &types.Error{
		Code:    14,
		Message: "Nonce invalid",
	}

	// ErrInvalidPublicKey is returned when public key
	// is invalid.
	ErrInvalidPublicKey = &types.Error{
		Code:    15,
		Message: "Public key invalid",
	}

	// ErrInvalidTransaction is returned when transaction
	// is invalid.
	ErrInvalidTransaction = &types.Error{
		Code:    16,
		Message: "Transaction invalid",
	}

	// ErrFetchFunctionSignatureMethodID is returned when
	// hash.Write fails to hash a function signature
	ErrFetchFunctionSignatureMethodID = &types.Error{
		Code:    17,
		Message: "Failed to hash function signature",
	}

	// ErrInvalidTokenContractAddress is returned when the token
	// contract address is invalid
	ErrInvalidTokenContractAddress = &types.Error{
		Code:    18,
		Message: "Invalid token contract address",
	}

	// ErrBadRequest is returned when the request is invalid
	ErrBadRequest = &types.Error{
		Code:    19,
		Message: "Bad request",
	}

	// ErrUnableToParseTransaction is returned when the transaction
	// cannot be parsed
	ErrUnableToParseTransaction = &types.Error{
		Code:    20,
		Message: "unable to parse the transaction",
	}

	// ErrInvalidGasLimit is returned when input gas limit
	// is invalid.
	ErrInvalidGasLimit = &types.Error{
		Code:    22,
		Message: "Gas limit invalid",
	}

	// ErrInvalidGasCap is returned when input gas cap
	// is invalid.
	ErrInvalidGasCap = &types.Error{
		Code:    23,
		Message: "Gas cap invalid",
	}

	// ErrInvalidGasTip is returned when input gas cap
	// is invalid.
	ErrInvalidGasTip = &types.Error{
		Code:    24,
		Message: "Gas tip invalid",
	}
)

Functions

func WrapErr

func WrapErr(rErr *types.Error, err error) *types.Error

WrapErr adds details to the types.Error provided. We use a function to do this so that we don't accidentally overwrite the standard errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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