Trapping the exception number

Each built-in exception has a name and a number (they are defined as an enumerated data type, EXCEPTION). For example, the exception generated when a verify fails is E_VERIFY ( 13700), and the exception generated when there is a division by zero is E_DIVIDE_BY_ZERO ( 11500).

All exceptions are defined in 4test.inc, in the directory where you installed Silk Test Classic.

You can use the ExceptNum function to test for which exception has been generated and, perhaps, take different actions based on the exception. You would capture the exception in a do...except statement then check for the exception using ExceptNum.

For example, if you want to ignore the exception E_WINDOW_SIZE_ INVALID, which is generated when a window is too big for the screen, you could do something like this:

do
Open.Invoke ()
except
if (ExceptNum () != E_WINDOW_SIZE_INVALID)
 reraise

If the exception is not E_WINDOW_SIZE_INVALID, the exception is reraised (and passed to the recovery system for processing). If the exception is E_ WINDOW_SIZE_INVALID, it is ignored.