Not implemented for APL internal classes or system classes
Syntax:
error_message „ 'env' ŚLE 0
objectref „ 'env' ŚLE 1
The system function ŚLE can be used to get information about the most recent exception that was caught by APLX during a call to an external environment such as .Net or Java.
The left argument is a character vector which specifies the external environment for which you want exception information, in the same format as for ŚNEW. The right argument is an integer which specifies which information you require:
| Code | Information returned |
| 0 | Return the last error message associated with an exception in the specified environment |
| 1 | Return a reference to the exception object |
Once obtained, the object reference to the exception can be retained: it is unaffected by any subsequent exceptions. If no exception has ever occurred in the specified environment the error message is an empty character vector and a NULL object reference is returned.
© Do something which causes an exception
date„'.net' ŚNEW 'System.DateTime' 2008 02 16
date.Year
2008
date.Year„2009
Property Year is read-only
DOMAIN ERROR
date.Year„2009
^
© Use ŚLE to investigate
'.net' ŚLE 0
Property Year is read-only
exception„'.net' ŚLE 1
exception.ŚCLASSREF
{.net:Exception}
exception.Message
Property Year is read-only
© Do something which causes an exception
a„'java' ŚNEW 'java.math.BigInteger' '123'
a.testBit Ż3
Cannot call method
JVM: Exception in thread "main"
DOMAIN ERROR
a.testBit Ż3
^
© Use ŚLE to investigate
x„'java' ŚLE 1
x.Śds
java.lang.ArithmeticException: Negative bit address
x.getStackTrace
[java:StackTraceElement]
x.getStackTrace.ŚDS
[Ljava.lang.StackTraceElement;@ca0b6
(x.getStackTrace).toString
java.math.BigInteger.testBit(Unknown Source)
For the R interface, the right argument of 1 (exception object) is not supported, but the latest error message is.