JavaScript try-catch bug?

Ran across a seemingly bad bug either in Rhino or JavaScript language spec – haven’t had a chance to dig into. But this pattern appears to let an exception raised in func() leak thru the surrounding try block:

  function foo()
  {
    try { return func(); }
    catch (err) { ... }
  }

I was able to work around by assigning to a local variable:

  function foo()
  {
    try { var x = func(); return x; }
    catch (err) { ... }
  }

Did a short Google on this, but nothing obvious turned up.

Comments are closed.