errors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: Apache-2.0 Imports: 2 Imported by: 28

Documentation

Overview

nolint

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

func ErrMissingSignature

func ErrMissingSignature() error

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

func ErrUnrecognizedAddress

func ErrUnrecognizedAddress(addr []byte) error

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

func IsInternalErr

func IsInternalErr(err error) bool

IsInternalErr matches any error that is not classified

func IsInvalidChainIDErr

func IsInvalidChainIDErr(err error) bool

func IsInvalidSignatureErr

func IsInvalidSignatureErr(err error) bool

func IsMissingSignatureErr

func IsMissingSignatureErr(err error) bool

func IsModifyChainIDErr

func IsModifyChainIDErr(err error) bool

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

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

func IsUnrecognizedAddressErr

func IsUnrecognizedAddressErr(err error) bool

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