Well $error wont catch "<command> Unknown command" and evaluating $2- as a command is very dangerous even if it is for a ulevel of 1500.
However you seem to be right
alias testerror {
echo -a $or()
:error
echo -a this: $error FAILED
echo $iif(1,1,2) $error ERROR FAILED
echo -a $error ALSO FAILED
}
as suppose to
alias testerror {
echo -a $or()
:error
echo -a $error FAILED
;echo $iif(1,1,2) $error ERROR FAILED
echo -a $error ALSO FAILED
}
I have no clue why it would do such a thing because no error in the :error section seems to retrigger the :error handling.
You could save $error into a %error variable prior to using $error. However this wont stop from /reseterror to be triggered and therefor not propagate backwards to any calling aliases which might be the behaviour you want.