Try OpenEdge Now
skip to main content
BPM Events User's Guide
Accessing Java objects and EJB components : Rule language extensions : Exception catching
 

Exception catching

Exception catching is a procedure that gets exceptions generated by Java object invocation. The syntax is similar to Java, and is used inside blocs (either the action part of a rule, or the initialize{} and finalize{} sections). This procedure is shown in the following example:
try_statement() ::= "try" compound_statement() ( catch_statement() ) +
catch_statement() ::= "catch" "(" <ID> ":" type() ")"
compound_statement()
throw_statement() ::= "throw" expr() ";"
Note that Java exception catching is only supported in complex statements (blocs), that is, not in rule conditions. In order to extend it to rule conditions, we recommend:
*"Wrapping" the method invocations on objects in conditions, inside a BPM Events function defined at module level. This method catches exceptions.
*Writing a function of type boolean (predicate) representing the exception-sensitive condition, in cases when the result of a condition containing a Java access varies based on exceptions raised by the Java call.