errors

package
v0.1.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	CodeTypeInternalErr        uint32 = 1
	CodeTypeEncodingErr        uint32 = 2
	CodeTypeUnauthorized       uint32 = 3
	CodeTypeUnknownRequest     uint32 = 4
	CodeTypeUnknownAddress     uint32 = 5
	CodeTypeBaseUnknownAddress uint32 = 5 //
	CodeTypeBadNonce           uint32 = 6

	CodeTypeBaseInvalidInput  uint32 = 20
	CodeTypeBaseInvalidOutput uint32 = 21
)

Variables

This section is empty.

Functions

func CheckResult

func CheckResult(err error) abci.ResponseCheckTx

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

func DeliverResult

func DeliverResult(err error) abci.ResponseDeliverTx

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

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 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

Types

type CheckErr

type CheckErr func(error) bool

CheckErr is the type of all the check functions here

type TMError

type TMError interface {
	ErrorCode() uint32
	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 uint32) 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 uint32) 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 uint32) 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