report errors

Modify CheckErr and StopOnErrErr to report the error if there aren't any
other messages.
This commit is contained in:
Billie H. Cleek 2014-06-29 21:32:53 -07:00 committed by spf13
parent 78962a14f8
commit 73dd4f38d0

View file

@ -8,17 +8,25 @@ import (
func CheckErr(err error, s ...string) {
if err != nil {
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 {
if len(s) == 0 {
jww.CRITICAL.Println(err)
} else {
for _, message := range s {
jww.CRITICAL.Println(message)
}
}
os.Exit(-1)
}
}