I get confused by java vs js exceptions too, but light seems to be shed
by running scripts like this:
function jsexception(){
try{throw "lordy";}
catch(ex){
print("exception: "+ex);
print("rhinoException: "+ex.rhinoException);
print("wrapped exception
"+ex.rhinoException.getWrappedException());
}
}
print("trying jsexception");
try{
jsexception();
}catch(ex){
print("caught exception from calling jsexception");
print("caught: "+ex);
}
print("trying npe()");
function npe(){
//throw an unchecked java Throwable
try{throw new java.lang.NullPointerException("my npe");}
catch(ex){
print("if you get here, the npe was caught by javascript");
print("npe exception: "+ex);
print("javaException: "+ex.javaException);
print("rhinoException: "+ex.rhinoException);
print("wrapped javaException:
"+ex.javaException.getWrappedException());
}
}
npe();
Terry Braun wrote:
And more:
Q: are all exceptions which are catchable while running a script in the
shell, errors with a .javaException and .rhinoException properties?
Q. can you always call err.rhinoException.getWrappedException() ?
Q. Will the value returned by err.rhinoException.getWrappedException()
be the same as err.javaException;
Terry Braun wrote:
I am confused by the whole exception thing and was hoping someone
could shed some light.
When I am running a script in the shell what are the possible
exceptions that can be caught and when?
I know I can throw an exception using javascript
>throw "pie";
And there are exceptions with a rhinoException property.
catch(err) {
err.rhinoException ...
Q: are there non-javascript exceptions which do not have a
rhinoException property?
Q: are there err.rhinoExceptions which are not instances of
org.mozilla.javascript.WrappedExceptions?
Q: are there other types of exceptions than these?
Q: did I miss some documentation someplace?
Thanks
terry
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino