Subj : Re: Throwing host exception from host object To : netscape.public.mozilla.jseng From : Brendan Eich Date : Wed Mar 17 2004 09:58 am Igor Bukanov wrote: > Note also that Rhino supports ECMAScript script extension that can be > used to rewrite that as > > try { > host.causeExceptions(); > } catch(exception if excetion instanceof MyExceptionType) { > // got it > } catch(exception if excetion instanceof MyExceptionType2) { > // got it > } catch(exception if myExceptionCheck(excetion)) { > // got it > } catch (exception) { > // optional catch-all > } > > Effectively you can use "if arbitrary-boolean-expression" to add a > condition-specific handler. A non-obvious virtue of these guarded catch clauses is that you get an automatic rethrow if there is no final unguarded "catch-all" clause. /be .