errors

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthErrors        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowErrors          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupErrors = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Codes = &codes{
	None:                   code("none"),
	UnknownAddress:         code("unknown address"),
	InsufficientBalance:    code("insufficient balance"),
	InvalidJumpDest:        code("invalid jump destination"),
	InsufficientGas:        code("insufficient gas"),
	MemoryOutOfBounds:      code("memory out of bounds"),
	CodeOutOfBounds:        code("code out of bounds"),
	InputOutOfBounds:       code("input out of bounds"),
	ReturnDataOutOfBounds:  code("data out of bounds"),
	CallStackOverflow:      code("call stack overflow"),
	CallStackUnderflow:     code("call stack underflow"),
	DataStackOverflow:      code("data stack overflow"),
	DataStackUnderflow:     code("data stack underflow"),
	InvalidContract:        code("invalid contract"),
	PermissionDenied:       code("permission denied"),
	NativeContractCodeCopy: code("tried to copy native contract code"),
	ExecutionAborted:       code("execution aborted"),
	ExecutionReverted:      code("execution reverted"),
	NativeFunction:         code("native function error"),
	EventPublish:           code("event publish error"),
	InvalidString:          code("invalid string"),
	EventMapping:           code("event mapping error"),
	Generic:                code("generic error"),
	InvalidAddress:         code("invalid address"),
	DuplicateAddress:       code("duplicate address"),
	InsufficientFunds:      code("insufficient funds"),
	Overpayment:            code("overpayment"),
	ZeroPayment:            code("zero payment error"),
	InvalidSequence:        code("invalid sequence number"),
	ReservedAddress:        code("address is reserved for SNative or internal use"),
	IllegalWrite:           code("callee attempted to illegally modify state"),
	IntegerOverflow:        code("integer overflow"),
	InvalidProposal:        code("proposal is invalid"),
	ExpiredProposal:        code("proposal is expired since sequence number does not match"),
	ProposalExecuted:       code("proposal has already been executed"),
	NoInputPermission:      code("account has no input permission"),
	InvalidBlockNumber:     code("invalid block number"),
	BlockNumberOutOfRange:  code("block number out of range"),
	AlreadyVoted:           code("vote already registered for this address"),
	UnresolvedSymbols:      code("code has unresolved symbols"),
	InvalidContractCode:    code("contract being created with unexpected code"),
	NonExistentAccount:     code("account does not exist"),
	NotCallable:            code("cannot dispatch call"),
}

Functions

This section is empty.

Types

type CallError added in v0.23.0

type CallError struct {
	// The error from the original call which defines the overall error code
	CodedError
	// Errors from nested sub-calls of the original call that may have also occurred
	NestedErrors []NestedCallError
}

func (CallError) Error added in v0.23.0

func (err CallError) Error() string

type Code

type Code struct {
	Number      uint32
	Name        string
	Description string
}

An annotated version of the pure numeric error code

func GetCode added in v0.34.4

func GetCode(err error) *Code

func (*Code) Equal added in v0.34.4

func (c *Code) Equal(other *Code) bool

func (*Code) Error

func (c *Code) Error() string

func (*Code) ErrorCode

func (c *Code) ErrorCode() *Code

func (*Code) ErrorMessage added in v0.34.4

func (c *Code) ErrorMessage() string

func (*Code) Uint32 added in v0.20.0

func (c *Code) Uint32() uint32

type CodedError

type CodedError interface {
	error
	ErrorCode() *Code
	// The error message excluding the code
	ErrorMessage() string
}

type Exception

type Exception struct {
	CodeNumber           uint32   `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"`
	Exception            string   `protobuf:"bytes,2,opt,name=Exception,proto3" json:"Exception,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func AsException added in v0.20.0

func AsException(err error) *Exception

Wraps any error as a Exception

func Errorf

func Errorf(code *Code, format string, a ...interface{}) *Exception

func NewException added in v0.20.1

func NewException(code *Code, exception string) *Exception

func Wrap

func Wrap(err error, message string) *Exception

func Wrapf added in v0.34.4

func Wrapf(err error, format string, a ...interface{}) *Exception

func (*Exception) AsError

func (e *Exception) AsError() error

func (*Exception) Descriptor

func (*Exception) Descriptor() ([]byte, []int)

func (*Exception) Equal added in v0.23.0

func (e *Exception) Equal(ce CodedError) bool

func (*Exception) Error

func (e *Exception) Error() string

func (*Exception) ErrorCode

func (e *Exception) ErrorCode() *Code

func (*Exception) ErrorMessage added in v0.34.4

func (e *Exception) ErrorMessage() string

func (*Exception) GetCode

func (e *Exception) GetCode() *Code

func (*Exception) GetCodeNumber added in v0.34.4

func (m *Exception) GetCodeNumber() uint32

func (*Exception) GetException

func (m *Exception) GetException() string

func (*Exception) Marshal added in v0.20.0

func (m *Exception) Marshal() (dAtA []byte, err error)

func (*Exception) MarshalTo added in v0.20.0

func (m *Exception) MarshalTo(dAtA []byte) (int, error)

func (*Exception) MarshalToSizedBuffer added in v0.34.4

func (m *Exception) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Exception) ProtoMessage

func (*Exception) ProtoMessage()

func (*Exception) Reset

func (m *Exception) Reset()

func (*Exception) Size added in v0.20.0

func (m *Exception) Size() (n int)

func (*Exception) String

func (e *Exception) String() string

func (*Exception) Unmarshal added in v0.20.0

func (m *Exception) Unmarshal(dAtA []byte) error

func (*Exception) XXX_DiscardUnknown

func (m *Exception) XXX_DiscardUnknown()

func (*Exception) XXX_Marshal

func (m *Exception) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Exception) XXX_Merge

func (m *Exception) XXX_Merge(src proto.Message)

func (*Exception) XXX_MessageName added in v0.20.0

func (*Exception) XXX_MessageName() string

func (*Exception) XXX_Size

func (m *Exception) XXX_Size() int

func (*Exception) XXX_Unmarshal

func (m *Exception) XXX_Unmarshal(b []byte) error

type LacksNativePermission added in v0.34.4

type LacksNativePermission struct {
	Address    crypto.Address
	NativeName string
}

func (*LacksNativePermission) Error added in v0.34.4

func (e *LacksNativePermission) Error() string

func (*LacksNativePermission) ErrorCode added in v0.34.4

func (e *LacksNativePermission) ErrorCode() *Code

func (*LacksNativePermission) ErrorMessage added in v0.34.4

func (e *LacksNativePermission) ErrorMessage() string

type Maybe added in v0.34.4

type Maybe struct {
	// contains filtered or unexported fields
}

func (*Maybe) Address added in v0.34.4

func (m *Maybe) Address(value crypto.Address, err error) crypto.Address

func (*Maybe) BigInt added in v0.34.4

func (m *Maybe) BigInt(value *big.Int, err error) *big.Int

func (*Maybe) Bool added in v0.34.4

func (m *Maybe) Bool(value bool, err error) bool

func (*Maybe) Bytes added in v0.34.4

func (m *Maybe) Bytes(value []byte, err error) []byte

func (*Maybe) Error added in v0.34.4

func (m *Maybe) Error() error

func (*Maybe) PushError added in v0.34.4

func (m *Maybe) PushError(err error) bool

Errors pushed to state may end up in TxExecutions and therefore the merkle state so it is essential that errors are deterministic and independent of the code path taken to execution (e.g. replay takes a different path to that of normal consensus reactor so stack traces may differ - as they may across architectures)

func (*Maybe) Uint64 added in v0.34.4

func (m *Maybe) Uint64(value uint64, err error) uint64

func (*Maybe) Void added in v0.34.4

func (m *Maybe) Void(err error)

type NestedCallError added in v0.23.0

type NestedCallError struct {
	CodedError
	Caller     crypto.Address
	Callee     crypto.Address
	StackDepth uint64
}

func (NestedCallError) Error added in v0.23.0

func (err NestedCallError) Error() string

type PermissionDenied

type PermissionDenied struct {
	Address crypto.Address
	Perm    permission.PermFlag
}

func (PermissionDenied) Error

func (err PermissionDenied) Error() string

func (PermissionDenied) ErrorCode

func (err PermissionDenied) ErrorCode() *Code

type Sink added in v0.23.0

type Sink interface {
	// Push an error to the error. If a nil error is passed then that value should not be pushed. Returns true iff error
	// is non nil.
	PushError(error) bool
}

Error sinks are useful for recording errors but continuing with computation. Implementations may choose to just store the first error pushed and ignore subsequent ones or they may record an error trace. Pushing a nil error should have no effects.

type Source added in v0.34.4

type Source interface {
	// Returns the an error if errors occurred some execution or nil if none occurred
	Error() error
}

Jump to

Keyboard shortcuts

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