summary refs log tree commit diff stats
path: root/cmd/cetus-bing
diff options
context:
space:
mode:
authorAndinus <andinus@inventati.org>2020-03-16 01:20:19 +0530
committerAndinus <andinus@inventati.org>2020-03-16 01:20:19 +0530
commit03c467b836efcfcacca499518a2ba284bca299f6 (patch)
tree415b227c5d8daab8997b9de49e469c52e7fb86c0 /cmd/cetus-bing
parent53ecbbc03b8cd8e54479c2d90cbdae9921eaa127 (diff)
downloadcetus-03c467b836efcfcacca499518a2ba284bca299f6.tar.gz
Rewrite apod response retrival
Diffstat (limited to 'cmd/cetus-bing')
-rw-r--r--cmd/cetus-bing/cetus-bing.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/cmd/cetus-bing/cetus-bing.go b/cmd/cetus-bing/cetus-bing.go
index 871c96a..b8c397c 100644
--- a/cmd/cetus-bing/cetus-bing.go
+++ b/cmd/cetus-bing/cetus-bing.go
@@ -4,7 +4,6 @@ import (
 	"encoding/json"
 	"flag"
 	"fmt"
-	"log"
 	"math/rand"
 	"time"
 
@@ -60,7 +59,7 @@ func main() {
 
 	bpod := bpod{}
 	err = json.Unmarshal([]byte(body), &bpod)
-	errChk("body unmarshal failed", err)
+	cetus.ErrChk("body unmarshal failed", err)
 
 	// if random was set then bpodRes holds list of multiple
 	// responses, choose a random response from the list
@@ -72,7 +71,7 @@ func main() {
 
 	// correct date format
 	dt, err := time.Parse("20060102", bpodPhoto.startDate)
-	errChk("bpodPhoto.startDate parse failed", err)
+	cetus.ErrChk("bpodPhoto.startDate parse failed", err)
 	bpodPhoto.startDate = dt.Format("2006-01-02")
 
 	printDetails(bpodPhoto)
@@ -83,7 +82,7 @@ func main() {
 	}
 
 	err = background.Set(bpodPhoto.url)
-	errChk("setting background failed", err)
+	cetus.ErrChk("setting background failed", err)
 }
 
 func parseFlags() {
@@ -126,8 +125,3 @@ func bpodBody() (string, error) {
 	body, err := bing.GetBpodJson(reqInfo, t)
 	return body, err
 }
-
-func errChk(ctx string, err error) {
-	log.Println(ctx)
-	log.Fatal(err)
-}