Skip to content

Commit

Permalink
Merge pull request #72 from ethereum/go-errors
Browse files Browse the repository at this point in the history
Go bindings: add missing error codes
  • Loading branch information
chfast authored Aug 20, 2018
2 parents bae63c1 + a65e9fd commit 6e6d71a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bindings/go/evmc/evmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,21 @@ func (err Error) Error() string {
return "evmc: precompile failure"
case C.EVMC_CONTRACT_VALIDATION_FAILURE:
return "evmc: contract validation failure"
case C.EVMC_INTERNAL_ERROR:
return "evmc: internal error"
case C.EVMC_ARGUMENT_OUT_OF_RANGE:
return "evmc: argument out of range"
case C.EVMC_WASM_UNREACHABLE_INSTRUCTION:
return "evmc: the WebAssembly unreachable instruction has been hit during execution"
case C.EVMC_WASM_TRAP:
return "evmc: a WebAssembly trap has been hit during execution"
case C.EVMC_REJECTED:
return "evmc: rejected"
}

if code < 0 {
return fmt.Sprintf("evmc: unknown internal error (%d)", int32(code))
return fmt.Sprintf("evmc: internal error (%d)", int32(code))
}

panic(fmt.Sprintf("evmc: unknown status code %d", int32(code)))
return fmt.Sprintf("evmc: unknown non-fatal status code %d", int32(code))
}

const (
Expand Down

0 comments on commit 6e6d71a

Please sign in to comment.