Handle API error in validateColor
This commit is contained in:
parent
41b730d33d
commit
f79ea1df5d
4
color.go
4
color.go
@ -209,6 +209,10 @@ func (c *Client) ValidateColor(color Color) (Color, error) {
|
|||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
if resp.IsError() {
|
||||||
|
return nil, resp.GetLifxError()
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user