From 5597f3cb4161f5f9504a8d831e5004399c2d28b5 Mon Sep 17 00:00:00 2001 From: b4b4r07 Date: Tue, 26 Mar 2019 18:45:08 +0900 Subject: [PATCH] Stop app when something error happens and print them instead of log.Fatal --- main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 3d927da..167baa3 100644 --- a/main.go +++ b/main.go @@ -4,12 +4,13 @@ import ( "encoding/json" "flag" "fmt" - "github.com/gdamore/tcell" - "github.com/hokaccha/go-prettyjson" - "github.com/rivo/tview" "log" "os" "time" + + "github.com/gdamore/tcell" + "github.com/hokaccha/go-prettyjson" + "github.com/rivo/tview" ) var ( @@ -121,7 +122,8 @@ func read() { var value map[string]interface{} err := dec.Decode(&value) if err != nil { - log.Fatal(err) + log.Println(err) + app.Stop() } store.Lock()