diff options
author | Billie H. Cleek <billie.cleek@idexpertscorp.com> | 2014-06-29 21:32:53 -0700 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-06-30 15:26:40 -0400 |
commit | 73dd4f38d0ffef1de9ced3d03596afb252f69333 (patch) | |
tree | f285b08bb0dedde31b0b06011838a0c08d1e23db /utils | |
parent | 78962a14f86bd6404b467739eb6cc382aecc64c3 (diff) |
report errors
Modify CheckErr and StopOnErrErr to report the error if there aren't any
other messages.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.go | 16 |
1 files 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) } |