summary refs log tree commit diff stats
path: root/svc/init.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-06 18:16:29 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-08 02:29:23 -0400
commit6c1b09bbeb1a7268a0d590e0a20ab2d34b395c8f (patch)
tree2c843adf344830510ff517f344b3af451955f98c /svc/init.go
parent5fa9ec1b63acc6ac9dc0a8b5d2f8f044c27ea45e (diff)
downloadgetwtxt-6c1b09bbeb1a7268a0d590e0a20ab2d34b395c8f.tar.gz
cleaned up error handling
Diffstat (limited to 'svc/init.go')
-rw-r--r--svc/init.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/svc/init.go b/svc/init.go
index aed3449..8e9bb20 100644
--- a/svc/init.go
+++ b/svc/init.go
@@ -40,6 +40,18 @@ var remoteRegistries = &RemoteRegistries{}
 
 var staticCache = &staticAssets{}
 
+func errFatal(context string, err error) {
+	if err != nil {
+		log.Fatalf(context+"%v\n", err.Error())
+	}
+}
+
+func errLog(context string, err error) {
+	if err != nil {
+		log.Printf(context+"%v\n", err.Error())
+	}
+}
+
 // I'm not using init() because it runs
 // even during testing and was causing
 // problems.
@@ -92,10 +104,8 @@ func watchForInterrupt() {
 
 			case *dbLevel:
 				lvl := dbType
-				if err := lvl.db.Close(); err != nil {
-					log.Printf("%v\n", err.Error())
-				}
-
+				err := lvl.db.Close()
+				errLog("", err)
 			}
 
 			if !confObj.StdoutLogging {