From 9e8fe73b8512faa22f5aceeda8705edf449e110c Mon Sep 17 00:00:00 2001 From: Paul Tyng Date: Tue, 23 Mar 2021 08:50:01 -0400 Subject: [PATCH] Return wrapped APIError --- unifi/unifi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unifi/unifi.go b/unifi/unifi.go index 429aee6..640694d 100644 --- a/unifi/unifi.go +++ b/unifi/unifi.go @@ -248,7 +248,7 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int Meta meta `json:"meta"` }{} err = json.NewDecoder(resp.Body).Decode(&errBody) - return fmt.Errorf("%s %s (%s) for %s %s", errBody.Meta.RC, errBody.Meta.Message, resp.Status, method, url.String()) + return fmt.Errorf("%w (%s) for %s %s", errBody.Meta.error(), resp.Status, method, url.String()) } if respBody == nil || resp.ContentLength == 0 {