Handle API error in validateColor

This commit is contained in:
Ryan Cavicchioni 2021-04-18 15:42:17 +00:00
parent 41b730d33d
commit f79ea1df5d
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -209,6 +209,10 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
defer resp.Body.Close()
if resp.IsError() {
return nil, resp.GetLifxError()
}
if err = json.NewDecoder(resp.Body).Decode(&s); err != nil {
return nil, err
}