On Nov 8, 8:00 pm, Daniel Friesen <[email protected]> wrote: > Side note, not completely solving re-throw issues, but JS 1.7 has a > useful feature that could help in most of your cases: > > doesRethrow = function(){ > try { > doesThrow(); > } catch( e if e > .5 ) { > // ... > } > > > > > > }; > wolffiex wrote: > > Hi list, > > I've got my application running great with Rhino. I'm at the point now > > where I want to clean up my exception handling. > > > If I let my script exceptions percolate up to Java, I get correct > > stack information about where the exception occurred. However, in > > cases where I want to catch the exception in script, conditionally > > process it, and maybe re-throw, I don't see how to get the original > > exception back. I'm hoping there's an API call that I just missed. > > > Here's an example > > > doesThrow = function(){ > > //stupid, but illustrates the point > > throw Math.random(); > > } > > > doesRethrow = function(){ > > try{ > > doesThrow() > > }catch(e){ > > //half of the errors are caught, half want to be re-thrown > > if (e > .5) { > > //this is the place where I want to be able to really re- > > throw the original > > //exception, complete with the stack information that > > includes the site > > //where the original exception occurred > > throw e; > > } else { > > ....//this is ok > > } > > } > > } > > > I'm still using 1.6, but would consider upgrading to the latest > > release if it'd help with this. > > > Thanks in advance, > > A > > -- > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
That is helpful,thanks, though I'm still interested if there's answer to the original question. After I posted this, I realized that it would also solve my problem if I could manually create some kind of exception that captured all the stack information. _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
