mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Rephrase error message and omit test case covered elsewhere
This commit is contained in:
parent
4293093a18
commit
b520bfbe96
2 changed files with 1 additions and 7 deletions
|
|
@ -277,7 +277,7 @@ func (c *Client) Call(result interface{}, method string, args ...interface{}) er
|
||||||
// can also pass nil, in which case the result is ignored.
|
// can also pass nil, in which case the result is ignored.
|
||||||
func (c *Client) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
|
func (c *Client) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error {
|
||||||
if result != nil && reflect.TypeOf(result).Kind() != reflect.Ptr {
|
if result != nil && reflect.TypeOf(result).Kind() != reflect.Ptr {
|
||||||
return fmt.Errorf("Expected nil or pointer for result, got %v", result)
|
return fmt.Errorf("call result parameter must be pointer or nil interface: %v", result)
|
||||||
}
|
}
|
||||||
msg, err := c.newMessage(method, args...)
|
msg, err := c.newMessage(method, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,6 @@ func TestClientResponseType(t *testing.T) {
|
||||||
t.Errorf("Passing nil as result should be fine, but got an error: %v", err)
|
t.Errorf("Passing nil as result should be fine, but got an error: %v", err)
|
||||||
}
|
}
|
||||||
var resultVar echoResult
|
var resultVar echoResult
|
||||||
if err := client.Call(&resultVar, "test_echo", "hello", 10, &echoArgs{"world"}); err != nil {
|
|
||||||
t.Errorf("Passing reference as result should be fine, but got an error: %v", err)
|
|
||||||
}
|
|
||||||
if resultVar.Int != 10 {
|
|
||||||
t.Errorf("Passing reference should work, but result is: %v", resultVar)
|
|
||||||
}
|
|
||||||
// Note: passing the var, not a ref
|
// Note: passing the var, not a ref
|
||||||
err := client.Call(resultVar, "test_echo", "hello", 10, &echoArgs{"world"})
|
err := client.Call(resultVar, "test_echo", "hello", 10, &echoArgs{"world"})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue