2 Replies Latest reply on Mar 12, 2015 3:26 PM by ddyer00

    errors in finally clause ?

    ddyer00 Level 1

      It appears that errors in a "finally" clause go completely undetected and unremarked, except that

      they change the return value to undefined

       

      function foo1(a) { return(a); }

      function foo2(a) { try { return(a); } finally { "no effect" ; }}

      function foo3(a) { try { return(a); } finally { b; "no effect"; }}     // "b" is a simulated typo

      function foo4(a) { try { b; return(a); } finally { "no effect"; }}     // "b" is a simulated typo

       

      It seems to me that foo3 ought to throw an error, or lacking that, return a.

      It does neither. It returns undefined.

       

      foo4 throws an error as I would expect.