From 8102c5d23feb0fe4794b73022f57c8fd2d591e4e Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 19 Jan 2024 20:20:20 +0100 Subject: good error msgs --- c_utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'c_utils.go') diff --git a/c_utils.go b/c_utils.go index 4af14de..72761d8 100644 --- a/c_utils.go +++ b/c_utils.go @@ -95,3 +95,13 @@ func c_die(str string, err error) { fmt.Fprintf(os.Stderr, "\n") os.Exit(1) } + +func c_error_mode(msg string, err error, ui *HardUI) { + ui.mode = ERROR_MODE + err_str := "" + if err != nil { + err_str = fmt.Sprintf("%v", err) + } + ui.err[ERROR_MSG] = msg + ui.err[ERROR_ERR] = err_str +} -- cgit v1.2.3