in your script you need to capture the error by using the Set Error Capture [<on or off>]. By setting it on, you are now responsible to deal with errors. Once error capture is on, the after a script step that may fail, use Get(LastError). This will return an error number, 0 is all is well. In case of an error, you can display a more meaningful message to the user and alter the script execution.
You say that even if an error is displayed that the em-mails get to the recipient. That's strange. Once you know the error number, you will be able to figure out what's going on.