From 5c146118d1877a953c197ba66e97614ab30255b2 Mon Sep 17 00:00:00 2001 From: berkgokden Date: Tue, 12 Feb 2019 13:35:23 +0100 Subject: [PATCH] Fix in error messages when not returned as json --- client/client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/client.go b/client/client.go index d3304cf..ecd3b46 100644 --- a/client/client.go +++ b/client/client.go @@ -165,7 +165,11 @@ Return the error object with message to be returned It can be used after checking with IsError */ func getError(resp *resty.Response) error { - return errors.New(resp.Error().(*ErrorResponse).Message) + message := resp.Error().(*ErrorResponse).Message + if message == "" { + message = string(resp.Body()) + } + return errors.New(message) } /*