From d033ed7b2392358537b8af682528bab5b7e7a9ea Mon Sep 17 00:00:00 2001 From: natemaia Date: Mon, 30 Sep 2019 19:45:54 -0700 Subject: [PATCH] Better error messages --- archlabs-installer | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/archlabs-installer b/archlabs-installer index 550be13..e06f1b1 100755 --- a/archlabs-installer +++ b/archlabs-installer @@ -5,7 +5,7 @@ # Some ideas and code reworked from other resources # AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due -VER=2.0.72 +VER=2.0.73 # bulk default values { @@ -2228,22 +2228,19 @@ errshow() local fatal=0 err="" err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$ERR")" + [[ -z $err ]] && err="no error message was found" (( $1 == 1 )) && { fatal=1; shift; } - if [[ $err ]]; then - local txt+="\nThe command exited abnormally:\n\n$1\n\nWith the following message:\n\n$err\n\n" - else - local txt+="\nThe command exited abnormally:\n\n$1\n\nWith no error message:\n\n" - fi + local txt="\nCommand: $1\n\n\n\nError: $err\n\n" if (( fatal )); then - msg "Install Error" "${txt}Errors at this stage are fatal and the install cannot continue.\n" + msg "Install Error" "${txt}Errors at this stage are fatal, the install cannot continue.\n" [[ -r $DBG && $TERM == 'linux' ]] && less "$DBG" die 1 fi - msg "Install Error" "${txt}Errors at this stage are non-fatal and can be either fixed or ignored depending on the error.\n" + msg "Install Error" "${txt}Errors at this stage are non-fatal and may be fixed or ignored depending on the error.\n" return 1 }