handle 404 errors

This commit is contained in:
Ryan Cavicchioni 2020-02-29 00:09:06 -06:00
parent 2fbfe9cae8
commit ed55cc3fbf
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -4,6 +4,7 @@ import (
"bytes"
//"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
@ -41,6 +42,8 @@ func (s *Client) Request(method, url string, body io.Reader) ([]Result, error) {
}
switch resp.StatusCode {
case http.StatusNotFound:
return nil, errors.New("Selector did not match any lights")
case http.StatusAccepted:
return nil, nil
case http.StatusMultiStatus: