Alias TestError {
if X
:error
if $error != $null { echo -a An Error has occured: $error | halt }
echo -a Script never gets this far.
}
The above does indeed work as qwerty explained. Let me paste something from the help file which is what led to my confusion.
Error handling
Script errors can be caught by adding an :error goto point to your script. When an error occurs, the script will jump to :error and continue running. $error returns the error message.
I had assumed this worked like a normal /goto statement would. If this is indeed intended behavior, perhaps the help file could be updated to explain it? The help file currently makes it sound like it will jump either back or forward, not just forward.
Thanks for explaining that, qwerty.