hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 73dd4f38d0ffef1de9ced3d03596afb252f69333
parent 78962a14f86bd6404b467739eb6cc382aecc64c3
Author: Billie H. Cleek <billie.cleek@idexpertscorp.com>
Date:   Sun, 29 Jun 2014 21:32:53 -0700

report errors

Modify CheckErr and StopOnErrErr to report the error if there aren't any
other messages.

Diffstat:
Mutils/utils.go | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git 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)
 	}