hugo/utils/utils.go
Billie H. Cleek 73dd4f38d0 report errors
Modify CheckErr and StopOnErrErr to report the error if there aren't any
other messages.
2014-06-30 15:26:40 -04:00

32 lines
479 B
Go

package utils
import (
"os"
jww "github.com/spf13/jwalterweatherman"
)
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)
}
}