<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Once an exception is thrown on a conseuqence the current session is
considered invalid. You'll need to add the try catch inside of the
actual consequence.<br>
<br>
Mark<br>
Yang Song wrote:
<blockquote
cite="mid:657190290708240122we2d23efi3be96750f96fb0b6@mail.gmail.com"
type="cite">
<div>Hi, </div>
<div> </div>
<div>Anyone knows how to catch the exception when firing the rules? </div>
<div> </div>
<div>I wrapped the session.fireAllRules() method using try...catch,
however it doesn't work: when someone wrote bad code in the rule's
action part, the Exception will be thrown and printed to the stderr,
and this will make the rule engine stop working -- the try...catch
outside doesn't help anything. </div>
<div> </div>
<div>If the exception thrown from the rule's action part can be
caught externally, the system can be protected from interrupting
Exception.</div>
<div>
<p><font style="background-color: rgb(255, 255, 255);" color="#3333ff"
face="courier new,monospace">try {<br>
_log.debug("Firing rules in : " + getName());</font></p>
<p><font style="background-color: rgb(255, 255, 255);" color="#3333ff"
face="courier new,monospace"> session.fireAllRules();</font></p>
<p><font style="background-color: rgb(255, 255, 255);" color="#3333ff"
face="courier new,monospace">} catch (Exception e) {<br>
_log.info("Error when firing rules: ", e);<br>
}</font> <br>
</p>
<p>Thanks, <br>
Yang</p>
</div>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>