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.


-- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to