Improve btcctl handling of empty RPC data returns.
There are several RPCs which do not return any data on success. btcctl was improperly treating this as an error condition.
This commit is contained in:
parent
ce142e8ca2
commit
d6f7adeba8
1 changed files with 6 additions and 8 deletions
|
@ -38,7 +38,6 @@ type handlerData struct {
|
||||||
|
|
||||||
// Errors used in the various handlers.
|
// Errors used in the various handlers.
|
||||||
var (
|
var (
|
||||||
ErrNoData = errors.New("No data returned.")
|
|
||||||
ErrNoDisplayHandler = errors.New("No display handler specified.")
|
ErrNoDisplayHandler = errors.New("No display handler specified.")
|
||||||
ErrUsage = errors.New("btcctl usage") // Real usage is shown.
|
ErrUsage = errors.New("btcctl usage") // Real usage is shown.
|
||||||
)
|
)
|
||||||
|
@ -792,10 +791,6 @@ func send(cfg *config, msg []byte) (interface{}, error) {
|
||||||
return nil, reply.Error
|
return nil, reply.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
if reply.Result == nil {
|
|
||||||
return nil, ErrNoData
|
|
||||||
}
|
|
||||||
|
|
||||||
return reply.Result, nil
|
return reply.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,9 +864,12 @@ func commandHandler(cfg *config, command string, data *handlerData, args []strin
|
||||||
|
|
||||||
// Display the results of the JSON-RPC command using the provided
|
// Display the results of the JSON-RPC command using the provided
|
||||||
// display handler.
|
// display handler.
|
||||||
|
if reply != nil {
|
||||||
err = data.displayHandler(reply)
|
err = data.displayHandler(reply)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue