Next: , Previous: Jasper Package Class Reference, Up: lib-jasper

10.18.5 Java Exception Handling

Exceptions are handled seamlessly between Java and Prolog. This means that exceptions can be thrown in Prolog and caught in Java and the other way around. For example, if a predicate called from Java throws an exception with throw/1 and the predicate itself does not catch the exception, the Java-method that performed the query, queryCutFail() for example, will throw an exception (of class SPException) containing the exception term. Symmetrically, a Java-exception thrown (and not caught) in a method called from Prolog will cause the corresponding predicate (simple/2 in the example above) to throw an exception consisting of the exception object (in the internal Prolog representation of a Java object). See Handling Java Exceptions for examples of catching Java exceptions in Prolog.

Send feedback on this subject.