Compare commits

..

No commits in common. "f79ea1df5d908f8473798b81bd4cddd455f0e8e8" and "2107a0586447e3e102667d5895d8c12827be5ebc" have entirely different histories.

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"net/http"
"strings" "strings"
) )
@ -200,6 +201,7 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
var ( var (
err error err error
s *HSBKColor s *HSBKColor
r *http.Response
resp *Response resp *Response
) )
@ -207,12 +209,13 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
return nil, err return nil, err
} }
defer resp.Body.Close() resp, err = NewResponse(r)
if err != nil {
if resp.IsError() { return nil, err
return nil, resp.GetLifxError()
} }
defer resp.Body.Close()
if err = json.NewDecoder(resp.Body).Decode(&s); err != nil { if err = json.NewDecoder(resp.Body).Decode(&s); err != nil {
return nil, err return nil, err
} }