From 9b8a3784a26eabf4e767914b92bc9ac77c972f5b Mon Sep 17 00:00:00 2001 From: bshore Date: Wed, 26 May 2021 19:39:19 -0500 Subject: [PATCH] handle error in Ping() --- hirezapi/connection.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hirezapi/connection.go b/hirezapi/connection.go index 5bd29f4..f567358 100644 --- a/hirezapi/connection.go +++ b/hirezapi/connection.go @@ -13,9 +13,12 @@ import ( func (a *APIClient) Ping() error { url := fmt.Sprintf("%s/%s%s", a.BasePath, "ping", a.RespType) resp, err := http.Get(url) - if resp.StatusCode != http.StatusOK { + if err != nil { return err } + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("error: Ping() did not return status 200: %d, Response: %s", resp.StatusCode, resp.Body) + } return nil }