From 240bebdb06b766504e49c6ad811ef9832088988b Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 4 Feb 2020 11:42:34 +0530 Subject: [PATCH] Tweak client error response to prefix status code --- client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index ef7b5c1..4f6efcd 100644 --- a/client/client.go +++ b/client/client.go @@ -176,7 +176,7 @@ func (c *Client) doHTTPReq(method, rURI string, reqBody interface{}, headers htt if err := json.Unmarshal(body, &resp); err != nil { return fmt.Errorf("error unmarshaling JSON response: %v", err) } - return errors.New(resp.Message) + return fmt.Errorf("%d: %s", r.StatusCode, resp.Message) } return nil