2013-10-09 18:52:29 -04:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2014-03-31 13:23:34 -04:00
|
|
|
|
|
|
|
jww "github.com/spf13/jwalterweatherman"
|
2013-10-09 18:52:29 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func CheckErr(err error, s ...string) {
|
|
|
|
if err != nil {
|
|
|
|
for _, message := range s {
|
2014-03-31 13:23:34 -04:00
|
|
|
jww.ERROR.Println(message)
|
2013-10-09 18:52:29 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-09 19:06:47 -04:00
|
|
|
func StopOnErr(err error, s ...string) {
|
2013-10-09 18:52:29 -04:00
|
|
|
if err != nil {
|
2014-03-31 13:23:34 -04:00
|
|
|
for _, message := range s {
|
|
|
|
jww.CRITICAL.Println(message)
|
|
|
|
}
|
2013-10-09 18:52:29 -04:00
|
|
|
os.Exit(-1)
|
|
|
|
}
|
|
|
|
}
|