file_not_found

This commit is contained in:
pvincent
2026-07-29 23:17:34 +04:00
parent bf1f802755
commit b44c523323
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -160,6 +160,13 @@ function on_error {
failure_type='COMMAND_NOT_FOUND'
failure_payload="${BASH_REMATCH[3]}"
miaou_debug "<command_not_found payload=${failure_payload}/>"
else
regex='^(.*): line ([0-9]+): (.*): No such file or directory$'
if [[ $failure_code == 127 && "$last_error" =~ $regex ]]; then
failure_type='FILE_NOT_FOUND'
failure_payload="${BASH_REMATCH[3]}"
miaou_debug "<file_not_found payload=${failure_payload}/>"
fi
fi
fi
miaou_debug '</investigate_tmp_error>'
@@ -334,6 +341,12 @@ function on_exit {
unset 'tmp_error[-1]' 'tmp_error[-1]'
add_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}"
miaou_debug '<command_not_found change_stderr />'
elif [[ -v failure_type && "$failure_type" == 'FILE_NOT_FOUND' ]]; then
unset 'tmp_error[-1]' 'tmp_error[-1]'
add_miaou_error "${BASH_SOURCE[1]}" "${BASH_LINENO[0]}" "${failure_code}" "${failure_type}" "${failure_payload}"
miaou_debug '<file_not_found change_stderr />'
elif [[ ! -v failure_type ]]; then
if [[ $failure_code -gt 0 && ${#tmp_error[@]} -gt 0 ]]; then
last_error="${tmp_error[-1]}"
+1 -1
View File
@@ -57,7 +57,7 @@ fail_type subshell_term SUBSHELL_ERROR
fail_type exit EXIT
fail_type command_not_found COMMAND_NOT_FOUND
fail_type source_not_found SOURCE_NOT_FOUND
fail_type file_not_found FILE_NOT_FOUND '(hint: prefer source than subshell)'
fail_type file_not_found FILE_NOT_FOUND
fail_type subshell_error COMMAND_NOT_FOUND '(hint: prefer source than subshell)'
failed=${#failures[@]}