For more information about V6 exception mode, see Using V6 exception compatibility).
If your code enters an onException block under V6 exception compatibility, EGL populates sysLib.currentException with information about the problem. Unlike post-V6 exceptions, which are records, sysLib.currentException is a dictionary, and its keys depend on the type of exception that was thrown.
sysLib.currentException always has a key named code, which is a string that identifies the exception.
You can access the exception fields only in an onException block. If your code accesses sysLib.currentException when EGL has not thrown an exception, the run unit terminates.
In the following example, the program determines the current exception by testing the code field:
if (userRequest == "A")
try
add record1;
onException
case (sysLib.currentException.code)
when ("com.ibm.egl.FileIOException")
myErrorHandler(12);
when ("com.ibm.egl.InvocationException")
myErrorHandler(13);
otherwise
myErrorHandler(15);
end
end
end
| Platform | Issue |
|---|---|
| COBOL generation | The variable sysLib.currentException is not supported |
| JavaScript generation | The variable sysLib.currentException is not supported |