summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-10-08 20:30:55 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-10-08 20:30:55 +0200
commitc47eac24b994daaa5ddddc80fb96e392f3d91671 (patch)
treeea6ca7f7e9e9dc05e626c3d69e746480e2e6f09c
parentd1e36e4a92f73e50fd6d1caa89df2322c13e13a0 (diff)
Report errorHEADmaster
-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