diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-07-03 18:22:20 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-07-03 18:22:20 +0800 |
commit | f0e94b4d714c45f7b03c66e01c643f4bd07033e3 (patch) | |
tree | f224cf2be0d2bd165c2353521306a62ec02a498f /rpc/codec/json.go | |
parent | cf6682622363f5a508742c8a4a96070042a3b44b (diff) | |
download | dexon-f0e94b4d714c45f7b03c66e01c643f4bd07033e3.tar.gz dexon-f0e94b4d714c45f7b03c66e01c643f4bd07033e3.tar.zst dexon-f0e94b4d714c45f7b03c66e01c643f4bd07033e3.zip |
display rpc error in console
Diffstat (limited to 'rpc/codec/json.go')
-rw-r--r-- | rpc/codec/json.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rpc/codec/json.go b/rpc/codec/json.go index b5ef94380..a4953a59c 100644 --- a/rpc/codec/json.go +++ b/rpc/codec/json.go @@ -156,15 +156,15 @@ func (self *JsonCodec) ReadResponse() (interface{}, error) { } bytesInBuffer += n + var failure shared.ErrorResponse + if err = json.Unmarshal(buf[:bytesInBuffer], &failure); err == nil && failure.Error != nil { + return failure, fmt.Errorf(failure.Error.Message) + } + var success shared.SuccessResponse if err = json.Unmarshal(buf[:bytesInBuffer], &success); err == nil { return success, nil } - - var failure shared.ErrorResponse - if err = json.Unmarshal(buf[:bytesInBuffer], &failure); err == nil && failure.Error != nil { - return failure, nil - } } self.c.Close() |