handle 404 errors
This commit is contained in:
parent
2fbfe9cae8
commit
ed55cc3fbf
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user