Better error messages
This commit is contained in:
parent
bb7dcfe5ba
commit
d033ed7b23
@ -5,7 +5,7 @@
|
|||||||
# Some ideas and code reworked from other resources
|
# Some ideas and code reworked from other resources
|
||||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||||
|
|
||||||
VER=2.0.72
|
VER=2.0.73
|
||||||
|
|
||||||
# bulk default values {
|
# bulk default values {
|
||||||
|
|
||||||
@ -2228,22 +2228,19 @@ errshow()
|
|||||||
|
|
||||||
local fatal=0 err=""
|
local fatal=0 err=""
|
||||||
err="$(sed 's/[^[:print:]]//g; s/\[[0-9\;:]*\?m//g; s/==> //g; s/] ERROR:/]\nERROR:/g' "$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; }
|
(( $1 == 1 )) && { fatal=1; shift; }
|
||||||
|
|
||||||
if [[ $err ]]; then
|
local txt="\nCommand: $1\n\n\n\nError: $err\n\n"
|
||||||
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
|
|
||||||
|
|
||||||
if (( fatal )); then
|
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"
|
[[ -r $DBG && $TERM == 'linux' ]] && less "$DBG"
|
||||||
die 1
|
die 1
|
||||||
fi
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user