try/catch/else

Isiah Meadows isiahmeadows at gmail.com
Tue Feb 13 11:30:45 UTC 2018


If you did `else` before `catch`/`finally`, that'd solve your problem. ;-)

The catch with `finally` (no pun intended) is this: does/should it
execute *before* or *after* else?
-----

Isiah Meadows
me at isiahmeadows.com

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Tue, Feb 13, 2018 at 4:48 AM, Alan Plum <me at pluma.io> wrote:
> Yikes, thanks for pointing that out. I guess this could be resolved by having a lower precedence for `catch/else` than `if/else` or by enforcing the sequence `try/else/catch` (as `try` without `catch` or `finally` is a syntax error).
>
>
> On Tue, Feb 13, 2018, at 2:06 AM, Waldemar Horwat wrote:
>> On 02/08/2018 06:50, Alan Plum wrote:
>> > I realise there is some ambiguity in using the else keyword for this (though I can't think of a meaningful opposite of "catch" either).
>>
>> Indeed.  You can't use 'else' without breaking existing behavior.  For example:
>>
>> if (foo) try {...} catch (e) {...} else {...}
>>
>>      Waldemar
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list