When a reaction handler returns 0, next reactions are executed;
instead, if it returns 1, the following reactions are not executed and
the chain is stopped.
The problem is that when a reaction returns 1, an error in
executing that reaction is reported.
The cause is the code in method TSession::_smmReact in source/
main/TSession.tcl:
if {[catch {if {[toSMM $expr]} {break}}]} { error... }
since TCL use an exception to handle break, continue and return;
catch... catches both these exceptions and the ones provoked by
an actual error in the reaction handler. This code makes no
differences between them and handles all of them as handler
errors. One solution should be replace the line with:
if {[catch {if {[toSMM $expr]} {break}}] == 1} { error... }
I actually have rearranged a little the code:
# first checks for execution errors
if { [catch {toSMM $expr} retcode] } {
# caught error would always be: expected boolean value but
got ""
# that's ok, though, because the real error got reported to the
session
# (or user forgot to return 1 or return 0 from reaction handler)
perror "executing reaction handler($handler) (error: $retcode)"
} elseif {$retcode} { break }
which now returns a more complete error message.
I've tested this change and it seems to work well.
--
Hamlet
New TSession.tcl ; corrected this bug and the "invalid command smmuser" one