mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
feat: return revert data
This commit is contained in:
parent
d61dc43696
commit
d8e8d7b6db
2 changed files with 4 additions and 2 deletions
|
|
@ -365,8 +365,7 @@ func (c *Client) CallContext(ctx context.Context, result interface{}, method str
|
||||||
resp := batchresp[0]
|
resp := batchresp[0]
|
||||||
switch {
|
switch {
|
||||||
case resp.Error != nil:
|
case resp.Error != nil:
|
||||||
errMsg := fmt.Sprintf("%s: %s", resp.Error.Message, resp.Error.Data)
|
return resp.Error
|
||||||
return errors.New(errMsg)
|
|
||||||
case len(resp.Result) == 0:
|
case len(resp.Result) == 0:
|
||||||
return ErrNoResult
|
return ErrNoResult
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,9 @@ func (err *jsonError) Error() string {
|
||||||
if err.Message == "" {
|
if err.Message == "" {
|
||||||
return fmt.Sprintf("json-rpc error %d", err.Code)
|
return fmt.Sprintf("json-rpc error %d", err.Code)
|
||||||
}
|
}
|
||||||
|
if err.Message == "execution reverted" && err.Data != "" {
|
||||||
|
return fmt.Sprintf("%s: %s", err.Message, err.Data)
|
||||||
|
}
|
||||||
return err.Message
|
return err.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue