Subj : Throwing host exception from host object To : netscape.public.mozilla.jseng From : Larry Blanchette Date : Tue Mar 16 2004 05:35 pm In rhino, I would like throw from a host object my own scriptable types as catchable exceptions of "my type" in javascript. I seems that extending EvaluatorException and using Context.throwAsScriptRuntimeEx(ex); is the path to follow but it does not allow me to propagate my type. The exception is caught as either "internalError" in the case of an evaluator exception and "JavaException" otherwise. Do I need to extend ScriptRuntime and override getCatchObject(Context cx, Scriptable scope, Throwable t) to handle and convert my exceptions (didn't want to go there)? So if have class MyExceptionType extends ScriptableObject and in host object I throw Context.throwAsScriptRuntimeEx(myScriptable); // illegal then i would try { host.causeExceptions(); } catch(exception) { if(excetion instanceof MyExceptionType) { // got it } } Thanks .