ExceptNum Function

Action

Returns the number of an exception.

Syntax

iNum = ExceptNum( )
Return Description
iNum The number of the exception. INTEGER.

Notes

  • ExceptNum returns the number of the most recent exception passed as an argument to the raise statement, by a 4Test script, or passed from an exception raised automatically by Silk Test Classic.

  • Exceptions from Silk Test Classic are assigned negative numbers. To avoid conflicts, use positive numbers for your own exceptions.

  • Exceptions are defined in 4Test.inc in the Silk Test Classic directory.

Example

[-] testcase ExceptNumExample () 
	[-] do 
		[ ] Verify ("xxx", "yyy") 
	[-] except 
		[ ] Print (ExceptNum () == E_VERIFY) 
	[-] do 
		[ ] raise 1, "My error" 
	[-] except 
		[ ] Print (ExceptNum ()) 
	[-] do 
		[ ] Print ("This will cause an exception. {5/0}")
	[-] except 
		[ ] Print (ExceptNum () == E_DIVIDE_BY_ZERO) 
	[ ] // Prints: 
	[ ] // TRUE 
	[ ] // 1 
	[ ] // TRUE