[rules-users] Exception Handling in the rule consequence

sumatheja sumatheja at gmail.com
Wed Oct 13 09:47:47 EDT 2010


Hi All,
        Can anyone give me sample code for exception handling in drools rule
consequence i.e RHS.


On Wed, Oct 13, 2010 at 7:12 PM, sumatheja <sumatheja at gmail.com> wrote:

> Hi Michael,
>                 I have written this rule in the guvnor editor, i did import
> java.lang.Exception.
>
> 2010/10/13 Michael Anstis <michael.anstis at gmail.com>
>
> Did you import the Exception class?
>>
>> 2010/10/13 sumatheja <sumatheja at gmail.com>
>>
>>> Hi All,
>>>         I have a set of rules. After firing the rules if an exception
>>> occurs in a rule the following rules are not getting evaluated. So i tried
>>> writing a try catch block inside the consequence part of the rule, but then
>>> i get an error saying "'unable to build the consequence.[Error:was expecting
>>> type: java.lang.Object but found type:null]"
>>>
>>> Here follows my code
>>>
>>>
>>> *rule 'Test rule'
>>> ruleflow-group "Test Ruleflow"
>>> no-loop
>>>     when
>>>         $c:Car()
>>>         Driver()
>>>
>>>     then
>>>        try{
>>>           $c.getModel()
>>>           } catch (Exception Ee) {
>>>            System.out.println("caught an exception: "+Ee.toString());
>>>           }
>>> end*
>>>
>>> However if i remove the try catch block it buils fine.
>>>
>>> Can anyone let me know if i'm missing something here.
>>>
>>> Thanks in advance :)
>>> --
>>> cheers
>>> Sumatheja
>>>
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> cheers
> Sumatheja Dasararaju
>
>
>


-- 
cheers
Sumatheja Dasararaju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101013/36ef455f/attachment.html 


More information about the rules-users mailing list