-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug?] throw
is said to be 'undefined command' when import
fail
#66
Comments
I tryed some, so report them. For all of below codes, I modified util/exception.sh a little bit: 28 command_not_found_handle() {
+ 29 echo $@
30 # USE DEFAULT IFS IN CASE IT WAS CHANGED
31 local IFS=$' \t\n'
32
Purpose: To check whether $1 will be passed to Tried to check whether alias is the problem: # modified code: in util/exception.sh
alias throw="__EXCEPTION_TYPE__=\${e:-Manually invoked} command_not_found_handle hoge"
# my script is the same one as above
# outputs
throw
✘ UNCAUGHT EXCEPTION: Undefined command (throw)
➦ Undefined command [oo-bootstrap.sh:84]
✘ System::SourcePath "${__oo__path}/${libPath}" "$@" || e="Cannot import $libPath" throw [oo-bootstrap.sh:84]
➦ System::ImportOne "$libPath" [oo-bootstrap.sh:96]
➦ System::Import [command_not_found_handle_test.sh:3]
✘ import file_not_exist [command_not_found_handle_test.sh:3]
⚡ Press [CTRL+C] to exit or [Return] to continue execution.
I have no idea what's happen here...omg
Purpose: To check whether It seems that I tested to call import util/exception util/log util/tryCatch
e="hello. test" throw "this is just atest" then outputs: ✘ UNCAUGHT EXCEPTION: hello. test (this is just atest)
e="➦ hello. test" throw "this is just atest" [command_not_found_handle_test.sh:9]
⚡ Press [CTRL+C] to exit or [Return] to continue execution.
⚙ Continuing... 3.1 call
|
sorry, this is not a bug of this framework, probably. |
Here's the code!! #!/usr/bin/env bash
alias test_a="command_not_found_handle"
command_not_found_handle() {
echo $*
}
test_a # call function using alias
echo '----'
command_not_found_handle # call function directly and here's outputs: $?is0[bugfix/throw-puts-wrong-exception]
<X_X>:bash-oo-framework$ ./test_throw_bug.sh # the above code
test_a
----
$?is0[bugfix/throw-puts-wrong-exception] |
It seems like a bash bug: even when the alias We can think about a good solution when planning for #45. |
I sent a bug-report to bash by using bashbug. If I find good solution, I'll post it to #45 And... Should we close this issue? |
Commit hash: 903fd74
While I tried importing my script, this error has been occurred:
(
launsh.sh
andlaunsh_lib/*
is mine)From my research, I figured out that
throw
was treated asexit_code
incommand_not_found_handle
:It's strange because
exit_code
should be$1
, not${FUNCNAME[0]}
.In this time,
exit_code
should be empty.Source:
bash-oo-framework/lib/util/exception.sh
Line 40 in 903fd74
Actually, this is strange too:
bash-oo-framework/lib/util/exception.sh
Line 33 in 903fd74
(because
$*
is expanded tothrow
)Unfortunately, I have no idea to solve this, so I post it.
the minimum example code:
The text was updated successfully, but these errors were encountered: