From f0e94b4d714c45f7b03c66e01c643f4bd07033e3 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Fri, 3 Jul 2015 12:22:20 +0200 Subject: display rpc error in console --- rpc/codec/json.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rpc/codec/json.go') 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() -- cgit