summaryrefslogtreecommitdiff
path: root/cmd/util
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/util')
-rw-r--r--cmd/util/cprint.go8
-rw-r--r--cmd/util/exit.go6
2 files changed, 11 insertions, 3 deletions
diff --git a/cmd/util/cprint.go b/cmd/util/cprint.go
index 85202b0a..3a986fd6 100644
--- a/cmd/util/cprint.go
+++ b/cmd/util/cprint.go
@@ -38,6 +38,10 @@ func Sprintf(format string, args ...interface{}) string {
}
// Panicf prints `<white+hb>color formatted message to STDERR</reset>`.
-func Panicf(format string, args ...interface{}) {
- fmt.Fprint(os.Stderr, Sprintf(format, args...))
+func Panicf(format string, args ...interface{}) error {
+ _, err := fmt.Fprint(os.Stderr, Sprintf(format, args...))
+ if err != nil {
+ return err
+ }
+ return nil
}
diff --git a/cmd/util/exit.go b/cmd/util/exit.go
index 96fcbf3c..8871a483 100644
--- a/cmd/util/exit.go
+++ b/cmd/util/exit.go
@@ -6,6 +6,10 @@ import (
// ExitWithError prints error and exits with error code`.
func ExitWithError(err error) {
- Panicf("<red+hb>Error:</reset> <red>%s</reset>\n", err)
+ errP := Panicf("<red+hb>Error:</reset> <red>%s</reset>\n", err)
+ if errP != nil {
+ // in case of error during Panicf, print this error via build-int print function
+ println("error occurred during fmt.Fprint: " + err.Error())
+ }
os.Exit(1)
}