From a8926aaab6e5f5fdbc5e3ff90ad7787596158c92 Mon Sep 17 00:00:00 2001 From: Martin Eskdale Moen Date: Mon, 7 Sep 2020 17:22:24 +0100 Subject: [PATCH] Include a custom message if there is an error This change lets us include a custom message if there is an error --- util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util.go b/util.go index 64fda9f..7d69f3c 100644 --- a/util.go +++ b/util.go @@ -7,8 +7,11 @@ import ( "strings" ) -func check(e error) { +func check(e error, optMsg ...string) { if e != nil { + if (len(optMsg) > 0) { + ExitFail("%s - %s", e, strings.Join(optMsg, " ")) + } ExitFail("%s", e) } }