From 885990d0fe59e6430d31cf74ed1f91ac0be436b1 Mon Sep 17 00:00:00 2001 From: Chao <200615@gmail.com> Date: Wed, 14 Mar 2018 17:25:15 +0800 Subject: [PATCH] fix bug --- helpers.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/helpers.go b/helpers.go index 873629e..9860f86 100644 --- a/helpers.go +++ b/helpers.go @@ -10,10 +10,15 @@ func handleError(err error, r *rpcResponse) error { if err != nil { return err } - if r.Err != nil { - rr := r.Err.(map[string]interface{}) - return errors.New(fmt.Sprintf("(%v) %s", rr["code"].(float64), rr["message"].(string))) + + if r.Err.Message != "" { + rr := r.Err + return errors.New(fmt.Sprintf("(%v) %s", rr.Code, rr.Message)) } + //if r.Err != nil { + // rr := r.Err.(map[string]interface{}) + // return errors.New(fmt.Sprintf("(%v) %s", rr["code"].(float64), rr["message"].(string))) + //} return nil }