errors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasErrorCode

func HasErrorCode(err error, code abci.CodeType) 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 IsInvalidFormatErr

func IsInvalidFormatErr(err error) bool

func IsMissingSignatureErr

func IsMissingSignatureErr(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 IsUnknownKeyErr

func IsUnknownKeyErr(err error) bool

func IsUnknownModuleErr

func IsUnknownModuleErr(err error) bool

func IsUnknownTxTypeErr

func IsUnknownTxTypeErr(err error) bool

func NoErr

func NoErr(err error) bool

NoErr is useful for test cases when you want to fulfil the CheckErr type

func Result

func Result(err error) abci.Result

Result converts any error into a abci.Result, preserving as much info as possible if it was already a TMError

Types

type CheckErr

type CheckErr func(error) bool

CheckErr is the type of all the check functions here

type TMError

type TMError interface {
	ErrorCode() abci.CodeType
	Message() string
	// contains filtered or unexported methods
}

TMError is the tendermint abci return type with stack trace

func ErrDecoding

func ErrDecoding() TMError

func ErrInternal

func ErrInternal(msg string) TMError

func ErrInvalidFormat

func ErrInvalidFormat(expected string, tx interface{}) TMError

func ErrMissingSignature

func ErrMissingSignature() TMError

func ErrTooLarge

func ErrTooLarge() TMError

func ErrUnauthorized

func ErrUnauthorized() TMError

func ErrUnknownKey

func ErrUnknownKey(mod string) TMError

func ErrUnknownModule

func ErrUnknownModule(mod string) TMError

func ErrUnknownTxType

func ErrUnknownTxType(tx interface{}) TMError

func New

func New(msg string, code abci.CodeType) TMError

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

func WithCode

func WithCode(err error, code abci.CodeType) TMError

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

func WithMessage

func WithMessage(prefix string, err error, code abci.CodeType) TMError

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

func Wrap

func Wrap(err error) TMError

Wrap safely takes any error and promotes it to a TMError

Jump to

Keyboard shortcuts

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