Robby Pelssers, AGP wrote:
Hi,
I'm facing a problem that my old javascript file no longer works
properly with constructions like instanceof, getClass(), throw. Can
someone point me out how to do this?
try {
} catch (ex) {
if (ex instanceof Packages.xxxx.xxxx.xxxx) {
//Do something 1
} else if (ex.getClass().getName().equals("xxxx")) {
//Do something 2
} else {
//Do something 3
throw(ex);
}
}
If I recall, the new version of Rhino treats exceptions from the Java
layer differently than it used to. It used to pass them up to the JS
catch statement directly, whereas now it wraps them in a
org.mozilla.javascript.WrappedException. You should be able to get
access to your original Java exception by unwrapping it with
ex.getWrappedException().
See
http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/WrappedException.html
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]