errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 24

Documentation

Index

Constants

View Source
const (
	CodeInternalErr         uint32 = 1
	CodeTxParseError               = 2
	CodeUnauthorized               = 3
	CodeUnknownRequest             = 4
	CodeUnrecognizedAddress        = 5
	CodeInvalidChainID             = 6
)

ABCI Response Codes Base SDK reserves 0 ~ 99.

Variables

This section is empty.

Functions

func ErrDecoding

func ErrDecoding() error

ErrDecoding is generic when we cannot parse the transaction input

func ErrInternal

func ErrInternal(msg string) error

ErrInternal is a generic error code when we cannot return any more useful info

func ErrInvalidChainID

func ErrInvalidChainID(chainID string) error

ErrInvalidChainID is when the chainID is the wrong format

func ErrInvalidSignature

func ErrInvalidSignature() error

ErrInvalidSignature is when the signature doesn't match (bad key, bad nonce, bad chainID)

func ErrMissingSignature

func ErrMissingSignature() error

ErrMissingSignature is returned when no signature is present

func ErrModifyChainID

func ErrModifyChainID() error

ErrModifyChainID is when someone tries to change the chainID after genesis

func ErrTooLarge

func ErrTooLarge() error

ErrTooLarge is a specific decode error when we pass the max tx size

func ErrUnauthorized

func ErrUnauthorized() error

ErrUnauthorized is a generic denial. You can use a more specific cause if you wish, such as ErrInvalidSignature

func ErrUnknownTxType

func ErrUnknownTxType(tx interface{}) error

ErrUnknownTxType creates an error for unexpected transaction objects

func ErrUnrecognizedAddress

func ErrUnrecognizedAddress(addr []byte) error

ErrUnrecognizedAddress may be used for empty addresses, or badly formatted addresses

func ErrUnrecognizedPermission added in v0.3.0

func ErrUnrecognizedPermission(perm []byte) error

ErrUnrecognizedPermission is used for anything that is not the proper format

func HasErrorCode

func HasErrorCode(err error, code uint32) bool

HasErrorCode checks if this error would return the named error code

func IsDecodingErr

func IsDecodingErr(err error) bool

IsDecodingErr returns true for any error with a ParseError code

func IsInternalErr

func IsInternalErr(err error) bool

IsInternalErr returns true for any error that is not classified

func IsInvalidChainIDErr

func IsInvalidChainIDErr(err error) bool

IsInvalidChainIDErr returns true iff an error was created with ErrInvalidChainID

func IsInvalidSignatureErr

func IsInvalidSignatureErr(err error) bool

IsInvalidSignatureErr returns true iff an error was created with ErrInvalidSignature

func IsMissingSignatureErr

func IsMissingSignatureErr(err error) bool

IsMissingSignatureErr returns true iff an error was created with ErrMissingSignature

func IsModifyChainIDErr

func IsModifyChainIDErr(err error) bool

IsModifyChainIDErr returns true iff an error was created with ErrModifyChainID

func IsSameError

func IsSameError(pattern error, err error) bool

IsSameError returns true if these errors have the same root cause. pattern is the expected error type and should always be non-nil err may be anything and returns true if it is a wrapped version of pattern

func IsTooLargeErr

func IsTooLargeErr(err error) bool

IsTooLargeErr returns true iff an error was created with ErrTooLarge

func IsUnauthorizedErr

func IsUnauthorizedErr(err error) bool

IsUnauthorizedErr is generic helper for any unauthorized errors, also specific sub-types

func IsUnknownTxTypeErr

func IsUnknownTxTypeErr(err error) bool

IsUnknownTxTypeErr returns true if an error was created with ErrUnknownTxType

func IsUnrecognizedAddressErr

func IsUnrecognizedAddressErr(err error) bool

IsUnrecognizedAddressErr returns true iff an error was created with ErrUnrecognizedAddress

func IsUnrecognizedPermissionErr added in v0.3.0

func IsUnrecognizedPermissionErr(err error) bool

IsUnrecognizedPermissionErr returns true iff an error was created with ErrUnrecognizedPermission

func New

func New(log string, code uint32) error

New creates an error with the given message and a stacktrace, and sets the code and log, overriding the state if err was already TMError

func NormalizePanic

func NormalizePanic(p interface{}) error

NormalizePanic converts a panic into a proper error

func Recover

func Recover(err *error)

Recover takes a pointer to the returned error, and sets it upon panic

Types

type TMError

type TMError interface {
	ABCICode() uint32
	ABCILog() string
	// contains filtered or unexported methods
}

TMError is the tendermint abci return type with stack trace

func WithCode

func WithCode(err error, code uint32) TMError

WithCode adds a stacktrace if necessary and sets the code and msg, overriding the code if err was already TMError

func WithLog

func WithLog(prefix string, err error, code uint32) TMError

WithLog prepends some text to the error, then calls WithCode It wraps the original error, so IsSameError will still match on err

Since

func Wrap

func Wrap(err error) TMError

Wrap safely takes any error and promotes it to a TMError. Doing nothing on nil or an incoming TMError.

Jump to

Keyboard shortcuts

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