Code:
Alias TestError {
  :error
  if $error != $null { echo -a An Error has occured: $error | halt }
  if X
  echo -a Script never gets this far.
}


Either the script isn't going to :error when an error occurs, and/or $error isn't being filled properly.