Failure Modes


The Failure Mode allows you to select what happens when a step has an error. A step may fail for many reasons, such as a file not existing, an incorrect parameter, or even as a planned failure.



The Failure Mode options are:

If the error occurs while running a child script, the result will be the same as if the child script terminated, and the parent will continue execution.

On Failure: Write to Log:   This option writes the error text to the logfile, even if logging is not currently turned on. See the Log/Reports Options section for information concerning the location of the logfile.

On Failure: Screenshot:   This option will take a snapshot of the entire screen in .BMP format, and save it to the same location as the logfile. See the Log/Reports Options section for information concerning the location of the logfile. The filename of the screen image will include the step number, and the date/time stamp that the error occurred.


Checking for Failures in Called Scripts
 

When any script fails, it sets the {failstep} system variable to the number of the step that had an error. This variable is reset each time a run is started. If no failure occurred, the variable will be 0 (or undefined).

This allows you to check the error/success of called scripts from a parent script.
Example:

Script 1:


Script 2:


Script #1 will call Script #2, which will fail (silently or visibly). Script #1 determines that the called script (#2) failed, and can act appropriately (stop, warn, etc). This should allow you to handle all possibilities for parent script error handling. As a side benefit of how it was implemented, you can also modify the value directly yourself, as it is stored in the registry under SOFTWARE\vTask\FailStep. This was necessary since multiple separate processes will need to access it, and it acts as a global variable.