class Exception example
Suppose you are using exceptions to manage execution in a deeply nested set of conditional statements and loops. You create your own exception class:
class JumpException of Exception
endclass
Then in the code, you create the JumpException object and THROW it if needed:
try
local j
j = new JumpException()
// Lots of nested code
...
if lItsNoGood
throw j // Deep in the code, you want out
endif
...
catch (JumpException e)
// Do nothing; JumpException is OK
catch (Exception e)
// Normal error
logError(new Date(), e.message) // Record error message
// and continue
endtry
If there is a normal error, the second CATCH block saves it to a log file, using a function you wrote, and execution continues.