hint ok
This commit is contained in:
+9
-2
@@ -178,7 +178,6 @@ function on_error {
|
||||
source="${BASH_REMATCH[1]}"
|
||||
lineno="${BASH_REMATCH[2]}"
|
||||
funcname="${BASH_REMATCH[3]}"
|
||||
[[ "$funcname" == '<main>' ]] && funcname="$funcname (hint: prefer source than child process)"
|
||||
extra_source=("$source")
|
||||
extra_lineno=("$lineno")
|
||||
extra_funcname=("$funcname")
|
||||
@@ -191,7 +190,6 @@ function on_error {
|
||||
source="${BASH_REMATCH[1]}"
|
||||
lineno="${BASH_REMATCH[2]}"
|
||||
funcname="${BASH_REMATCH[3]}"
|
||||
[[ "$funcname" == '<main>' ]] && funcname="$funcname (hint: prefer source than child process)"
|
||||
extra_source=("$source" "${extra_source[@]}")
|
||||
extra_lineno=("$lineno" "${extra_lineno[@]}")
|
||||
extra_funcname=("$funcname" "${extra_funcname[@]}")
|
||||
@@ -234,6 +232,15 @@ function on_error {
|
||||
error_source=("${extra_source[@]}" "${error_source[@]}")
|
||||
error_lineno=("${extra_lineno[@]}" "${error_lineno[@]}")
|
||||
error_funcname=("${extra_funcname[@]}" "${error_funcname[@]}")
|
||||
|
||||
# add the funcname hint message from backward
|
||||
local funcname hint_for_next=false
|
||||
for ((i = 0; i < ${#error_funcname[@]}; i++)); do
|
||||
is_true "$hint_for_next" && error_funcname[$i]+=' (hint: prefer source than child process)' && hint_for_next=false
|
||||
funcname="${error_funcname[$i]}"
|
||||
[[ "$funcname" == '<main>' ]] && hint_for_next=true || true
|
||||
done
|
||||
|
||||
else
|
||||
error_source=("${error_source[@]}")
|
||||
error_lineno=("${error_lineno[@]}")
|
||||
|
||||
Reference in New Issue
Block a user