summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/motd/fetch.go2
-rw-r--r--pkg/motd/motd.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/pkg/motd/fetch.go b/pkg/motd/fetch.go
index fd76d7c..2262152 100644
--- a/pkg/motd/fetch.go
+++ b/pkg/motd/fetch.go
@@ -56,7 +56,7 @@ func FetchLatest() []Message {
func fetchURL(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
- panic(err)
+ return []byte(""), err
}
defer resp.Body.Close()
return ioutil.ReadAll(resp.Body)
diff --git a/pkg/motd/motd.go b/pkg/motd/motd.go
index 4dead55..c2d2994 100644
--- a/pkg/motd/motd.go
+++ b/pkg/motd/motd.go
@@ -14,12 +14,12 @@ const ExampleFile = "motd-example.json"
func ParseFile(f string) (Messages, error) {
jsonFile, err := os.Open(f)
if err != nil {
- panic(err)
+ return Messages{}, err
}
defer jsonFile.Close()
byteVal, err := ioutil.ReadAll(jsonFile)
if err != nil {
- panic(err)
+ return Messages{}, err
}
return getFromJSON(byteVal)
}