summaryrefslogtreecommitdiffstats
path: root/nws
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2022-05-15 23:24:51 -0400
committersiddharth <s@ricketyspace.net>2022-05-15 23:25:19 -0400
commitceb8a50a802f3499a9e4a38940d7c001ce7d0004 (patch)
tree0ad5766e2e4de9a365f644e96945619df84e034c /nws
parent52b2555773473a3bbc0abe05ec2c8c61ad93a353 (diff)
nws: update Points
update error messages.
Diffstat (limited to 'nws')
-rw-r--r--nws/nws.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/nws/nws.go b/nws/nws.go
index 0c6d6e0..a3155ab 100644
--- a/nws/nws.go
+++ b/nws/nws.go
@@ -46,7 +46,7 @@ func Points(lat, lng float32) (*NWSPoint, error) {
// Parse response body.
body, err := io.ReadAll(resp.Body)
if err != nil {
- return nil, fmt.Errorf("getting points: body: %v", err)
+ return nil, fmt.Errorf("points: body: %v", err)
}
// Check if the request failed.
@@ -63,13 +63,13 @@ func Points(lat, lng float32) (*NWSPoint, error) {
point := new(NWSPoint)
err = json.Unmarshal(body, point)
if err != nil {
- return nil, fmt.Errorf("points: json decode: %v", err)
+ return nil, fmt.Errorf("points: decode: %v", err)
}
if point.Properties.Forecast == "" {
- return nil, fmt.Errorf("points: json: forecast empty")
+ return nil, fmt.Errorf("points: forecast empty")
}
if point.Properties.ForecastHourly == "" {
- return nil, fmt.Errorf("points: json: forecasthourly empty")
+ return nil, fmt.Errorf("points: forecasthourly empty")
}
return point, nil
}