From 73dd4f38d0ffef1de9ced3d03596afb252f69333 Mon Sep 17 00:00:00 2001 From: "Billie H. Cleek" Date: Sun, 29 Jun 2014 21:32:53 -0700 Subject: [PATCH] report errors Modify CheckErr and StopOnErrErr to report the error if there aren't any other messages. --- utils/utils.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index bb0248084..9d6e0a844 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -8,16 +8,24 @@ import ( func CheckErr(err error, s ...string) { if err != nil { - for _, message := range s { - jww.ERROR.Println(message) + if len(s) == 0 { + jww.CRITICAL.Println(err) + } else { + for _, message := range s { + jww.ERROR.Println(message) + } } } } func StopOnErr(err error, s ...string) { if err != nil { - for _, message := range s { - jww.CRITICAL.Println(message) + if len(s) == 0 { + jww.CRITICAL.Println(err) + } else { + for _, message := range s { + jww.CRITICAL.Println(message) + } } os.Exit(-1) }