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