Re: JESS: Catching a java exception via Jess in Java
"Ernest Friedman-Hill" <[email protected]> Thu, 13 Jan 2011 08:57:06 -0500
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
Hi Kero, Can you give me an example of where Jess prints an exception rather than rethrowing it? In general, exceptions from Java code are set as the "cause" of a JessException, and rethrown. For example, any exceptions that occur during a call to run() will be thrown from run(). You can recover the original exception by calling getCause() on the JessException object. On Jan 13, 2011, at 7:13 AM, Gelder, Kero van wrote: > Hello! > > We are writing unit tests around or software with JUnit and JMock. > When we run certain tests, Jess will call Java methods. > In the unit tests, JMock provides stubs for these methods. > With the expectations set, these method calls may raise an exception. > Jess catches this exception and prints it. > > Thus, JUnit does not see the exception. > So when JMock flags a failure, our tests still pass. > > A similar thing will happen in the deployed system, of course. > > Is it possible to let Jess re-throw the exception? > > We tried to find a flag to set on Jess, but could not find any. > > We know that try/catch in Jess can install a handler, but we do not > know how to wrap such try/catch when we call Rete.run() from Java. > > Other suggestions? > > Bye, > Kero. --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [email protected]' in the BODY of a message to [email protected], NOT to the list (use your own address!) List problems? Notify [email protected]. --------------------------------------------------------------------