> That is the correct behavior. If you escape the 'try' clause, say by
> throwing an exception, returning or breaking a loop, the finally
> clause can override that by escaping itself.
>
> How you avoid this depends on what you're trying to do. One way could
> be to move the return outside the finally clause, after the try-catch.
>
If I move the return outside "finally", it won't happen when an error
is catched, am I right?
My aim is to:
1) catch any error which prevents continuation of function evaluation,
2) throw it so it will get logged,
3) _always_ return some value so execution can continue.
Ondrej
> -- Christian
>
> On Thu, Oct 2, 2008 at 10:22 AM, ondras <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a function which contains the following:
>
> > function test() {
> > try {
> > some stuff
> > } catch(e) {
> > throw new Error("I want to report this via standard error catcher");
> > } finally {
> > return safe_value;
> > }
> > }
>
> > However, my error doesn't get thrown as long as the "finally"
> > statement contains "return". Is this correct behavior? Is there any
> > way to overcome this?
>
> > Thanks,
> > Ondrej Zara
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---