From: Chris A. <at...@nm...> - 2001-01-30 09:25:03
|
I am having problems throwing a java exception from my jython code and catching it in java. I have the following class structure: SomeIF.java ^ | SomeImpl.java SomeIF.java ^ | BaseImpl -- python class ^ | SpecificImpl - python class BaseImpl looks like the following: class BaseImpl(SomeIF): def __init__(self): pass def prehook(self, arg1, arg2): raise JException(arg2, "msg") def posthook(self, arg1, arg2): return None when BaseImpl.prehook() is called, my java code gets the exception as a JException. Specificmpl looks like the following: class SpecificImpl(BaseImpl): def __init__(self): pass def prehook(self, arg1, arg2): raise JException(arg2, "msg") when SpecificImpl.prehook() is called, my java code gets org.python.core.PyException Just for grins, I placed BaseImpl and SpecificImpl in the same module. Both exceptions are caught by the same method which has the following code: public void extest(SomeIF impl) { try { impl.foo(); } catch(Exception e) { System.out.println(e.getClass().getName()); } } I am creating the instances of BaseSomeImpl and SpecificSomeImpl in the jython interpreter and passing them to my java code. Any thoughts on what might be wrong? Thanks, Chris |