Caché Basic Reference
Identifies a block of code to execute when an exception occurs.
||Optional An exception variable. Specified as a local variable, with or without subscripts, that receives a reference to a Caché Object.
command defines an exception handler, one or more statements to execute when an exception occurs in the code following a Try
statement. The Catch
command is followed by one or more exception handling code statements. The Catch
block must immediately follow its Try
, and the paired Try
are terminated by an End Try
command has two forms:
Catch without an Argument
receives a Caché Object reference (oref) from the Throw
command or from the system runtime environment in the event of a system error. This Object provides properties that contain information about the exception, such as the Name of the error and the Location where it occurred. The user-written Catch
exception handler code can use this information to analyze the exception.
The following example shows a Catch
invoked by a runtime error. The myvar
argument receives a system-generated exception object:
PRINTLN "about to divide by zero"
PRINTLN "this should not display"
PRINTLN "this is the exception handler"
PRINTLN "Error is: ",Err.Description
PRINTLN "Error code: ",myvar.Code
PRINTLN "this is where the code falls through"