ExceptData Function

Action

Returns the data associated with the most recent exception.

Syntax

aData = ExceptData ( )
Return Description
aData The data from the most recent exception. ANYTYPE.

Notes

  • Exceptions are generated automatically by Silk Test Classic (implicit exceptions), or by your script, in response to application state (explicit exceptions).

  • For all exceptions raised by Silk Test Classic, the data returned by ExceptData is an error message string. For user-defined exceptions, which are generated with raise or reraise, the returned data can be any type.

Example

[-] testcase ExceptDataExample () 
	[-] do 
		[ ] Verify ("xxx", "yyy")
	[-] except 
		[ ] Print (ExceptData ()) 
	[-] do 
		[ ] raise 1, "My error" 
	[-] except 
		[ ] Print (ExceptData ()) 
	[-] do 
		[ ] Print ("This will cause an exception. {5/0}") 
	[-] except 
		[ ] Print (ExceptData ()) 
	[ ] // Prints: 
	[ ] // *** Error: Verify Failed - expected yyy, got xxx
	[ ] // My error 
	[ ] // *** Error: Divide by zero