mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
added a method for jsonError struct that always returns data from errors
This commit is contained in:
parent
a6751d6fc8
commit
1f65bb27ca
2 changed files with 5 additions and 1 deletions
|
|
@ -364,7 +364,7 @@ func (c *Client) CallContext(ctx context.Context, result interface{}, method str
|
|||
resp := batchresp[0]
|
||||
switch {
|
||||
case resp.Error != nil:
|
||||
return resp.Error
|
||||
return resp.Error.FullError()
|
||||
case len(resp.Result) == 0:
|
||||
return ErrNoResult
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -157,6 +157,10 @@ func (err *jsonError) ErrorData() interface{} {
|
|||
return err.Data
|
||||
}
|
||||
|
||||
func (err *jsonError) FullError() error {
|
||||
return fmt.Errorf("message: %v, code: %v, data: %v", err.Message, err.Code, err.Data)
|
||||
}
|
||||
|
||||
// Conn is a subset of the methods of net.Conn which are sufficient for ServerCodec.
|
||||
type Conn interface {
|
||||
io.ReadWriteCloser
|
||||
|
|
|
|||
Loading…
Reference in a new issue