Show TOC

Procedure documentationHandling Exceptions Locate this document in the navigation structure

 

This section provides information on the following

  • What happens if an exception is thrown while evaluating conditions?

  • What happens if the exception is thrown while firing an action?

  • Are checked/ unchecked exceptions handled differently?

Procedure

Exceptions While Evaluating Conditions

Exceptions thrown while evaluating conditions in a rule are considered FATAL and are broadcasted to the calling application code, wrapped in a RuleException. The RuleException Object can be obtained using the following code:

Syntax Syntax

  1.  try{ //	 engine.invokeRuleset... 	
    }catch(RuleException ruleException){ 	
    Exception rootException=ruleException().getRootException(); //	Process Root Exception.... 
    
End of the code.
Exceptions While Executing Actions

Exceptions thrown when executing actions of a rule are considered NON-FATAL. The stack trace of these exceptions is printed and the Engine continues to fire the actions of other satisfied rules.

Example Example

If an exception occurs while performing action B (in Rule1), then a message exception firing Rule1 will be printed on console along with stack trace. The Engine will continue to perform actions D & E of Rule2. Action C of Rule1 will however NOT be performed.

Rule1

3 actions, say A, B, C

Priority High

Rule2

2 actions say D, E

Priority Medium

End of the example.
Handling Checked/ Unchecked Exceptions

Checked and unchecked exceptions are handled in the same way. Engine makes no differentiation between these two.