github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/execution/errors/vm.go (about) 1 package errors 2 3 import ( 4 "fmt" 5 6 "github.com/hyperledger/burrow/crypto" 7 "github.com/hyperledger/burrow/permission" 8 ) 9 10 type PermissionDenied struct { 11 Address crypto.Address 12 Perm permission.PermFlag 13 } 14 15 func (err PermissionDenied) ErrorCode() *Code { 16 return Codes.PermissionDenied 17 } 18 19 func (err PermissionDenied) Error() string { 20 return fmt.Sprintf("Account/contract %v does not have permission %v", err.Address, err.Perm) 21 } 22 23 type NestedCallError struct { 24 CodedError 25 Caller crypto.Address 26 Callee crypto.Address 27 StackDepth uint64 28 } 29 30 func (err NestedCallError) Error() string { 31 return fmt.Sprintf("error in nested call at depth %v: %s (callee) -> %s (caller): %v", 32 err.StackDepth, err.Callee, err.Caller, err.CodedError) 33 } 34 35 type CallError struct { 36 // The error from the original call which defines the overall error code 37 CodedError 38 // Errors from nested sub-calls of the original call that may have also occurred 39 NestedErrors []NestedCallError 40 } 41 42 func (err CallError) Error() string { 43 return fmt.Sprintf("Call error: %v (and %d nested sub-call errors)", err.CodedError, len(err.NestedErrors)) 44 }