github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/execution/errors/errors.go (about)

     1  package errors
     2  
     3  type CodedError interface {
     4  	error
     5  	ErrorCode() *Code
     6  	// The error message excluding the code
     7  	ErrorMessage() string
     8  }
     9  
    10  // Error sinks are useful for recording errors but continuing with computation. Implementations may choose to just store
    11  // the first error pushed and ignore subsequent ones or they may record an error trace. Pushing a nil error should have
    12  // no effects.
    13  type Sink interface {
    14  	// Push an error to the error. If a nil error is passed then that value should not be pushed. Returns true iff error
    15  	// is non nil.
    16  	PushError(error) bool
    17  }
    18  
    19  type Source interface {
    20  	// Returns the an error if errors occurred some execution or nil if none occurred
    21  	Error() error
    22  }
    23  
    24  var Codes = &codes{
    25  	None:                   code("none"),
    26  	UnknownAddress:         code("unknown address"),
    27  	InsufficientBalance:    code("insufficient balance"),
    28  	InvalidJumpDest:        code("invalid jump destination"),
    29  	InsufficientGas:        code("insufficient gas"),
    30  	MemoryOutOfBounds:      code("memory out of bounds"),
    31  	CodeOutOfBounds:        code("code out of bounds"),
    32  	InputOutOfBounds:       code("input out of bounds"),
    33  	ReturnDataOutOfBounds:  code("data out of bounds"),
    34  	CallStackOverflow:      code("call stack overflow"),
    35  	CallStackUnderflow:     code("call stack underflow"),
    36  	DataStackOverflow:      code("data stack overflow"),
    37  	DataStackUnderflow:     code("data stack underflow"),
    38  	InvalidContract:        code("invalid contract"),
    39  	PermissionDenied:       code("permission denied"),
    40  	NativeContractCodeCopy: code("tried to copy native contract code"),
    41  	ExecutionAborted:       code("execution aborted"),
    42  	ExecutionReverted:      code("execution reverted"),
    43  	NativeFunction:         code("native function error"),
    44  	EventPublish:           code("event publish error"),
    45  	InvalidString:          code("invalid string"),
    46  	EventMapping:           code("event mapping error"),
    47  	Generic:                code("generic error"),
    48  	InvalidAddress:         code("invalid address"),
    49  	DuplicateAddress:       code("duplicate address"),
    50  	InsufficientFunds:      code("insufficient funds"),
    51  	Overpayment:            code("overpayment"),
    52  	ZeroPayment:            code("zero payment error"),
    53  	InvalidSequence:        code("invalid sequence number"),
    54  	ReservedAddress:        code("address is reserved for SNative or internal use"),
    55  	IllegalWrite:           code("callee attempted to illegally modify state"),
    56  	IntegerOverflow:        code("integer overflow"),
    57  	InvalidProposal:        code("proposal is invalid"),
    58  	ExpiredProposal:        code("proposal is expired since sequence number does not match"),
    59  	ProposalExecuted:       code("proposal has already been executed"),
    60  	NoInputPermission:      code("account has no input permission"),
    61  	InvalidBlockNumber:     code("invalid block number"),
    62  	BlockNumberOutOfRange:  code("block number out of range"),
    63  	AlreadyVoted:           code("vote already registered for this address"),
    64  	UnresolvedSymbols:      code("code has unresolved symbols"),
    65  	InvalidContractCode:    code("contract being created with unexpected code"),
    66  	NonExistentAccount:     code("account does not exist"),
    67  	NotCallable:            code("cannot dispatch call"),
    68  }
    69  
    70  func init() {
    71  	err := Codes.init()
    72  	if err != nil {
    73  		panic(err)
    74  	}
    75  }