I'm not sure this is what you're looking for, but it seems likely:
import java
import exceptions
try:
asdf
except exceptions.Exception, val:
print "Py", val
try:
java.lang.String( None )
except java.lang.Exception, val:
print "Java", val
>>> ## working on region in file d:/TEMP/python-506z_G...
Py asdf
Java java.lang.NullPointerException
kb
Yang Wang wrote:
>
> Hi All,
>
> Are there a way to distinguish Jython syntax exceptions from Java
> Exceptions?
>
> For instance:
>
> >>> try :
> ... from com.private.package import NonexistClass
> ... except PythonException, ex:
> ... print "Pyton:"
> ... except Exception, ex2:
> ... print "ex:"
> ... else:
> ... print "else:"
> ...
> Traceback (innermost last):
> File "<console>", line 2, in ?
> NameError: PythonException
>
> Thanks in advance.
>
> Yang
>
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
|