summaryrefslogtreecommitdiff
path: root/weather.go
diff options
context:
space:
mode:
Diffstat (limited to 'weather.go')
-rw-r--r--weather.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/weather.go b/weather.go
index 768ab93..7cee4b4 100644
--- a/weather.go
+++ b/weather.go
@@ -3,6 +3,7 @@ package weather
import (
"encoding/json"
+ "errors"
"fmt"
"io/ioutil"
"net/http"
@@ -158,6 +159,9 @@ func get(param string) (Current, error) {
return c, err
}
defer resp.Body.Close()
+ if resp.StatusCode != http.StatusOK {
+ return Current{}, errors.New(resp.Status)
+ }
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return c, err