aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/codec
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/codec')
-rw-r--r--rpc/codec/json.go10
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()