diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go new file mode 100644 index 000000000..641abfeb2 --- /dev/null +++ b/utils/utils.go @@ -0,0 +1,22 @@ +package utils + +import ( + "log" + "os" +) + +func CheckErr(err error, s ...string) { + if err != nil { + for _, message := range s { + log.Fatalf(message) + } + log.Fatalf("Fatal Error: %v", err) + } +} + +func CheckErrExit(err error, s ...string) { + if err != nil { + CheckErr(err, s...) + os.Exit(-1) + } +} |