try/catch/else
Isiah Meadows
isiahmeadows at gmail.com
Thu Feb 8 22:45:33 UTC 2018
I honestly wish engines (read: V8) didn't jave so much issue optimizing
that. But yes, it's a very useful pattern.
On Thu, Feb 8, 2018, 14:35 Mark Miller <erights at gmail.com> wrote:
> Hi Claude, that's nice. Whenever I faced this issue I always turned to the
> boolean flag variable. But this is strictly better. I expect to use it from
> now on. Thanks!
>
>
> On Thu, Feb 8, 2018 at 10:13 AM, Claude Pache <claude.pache at gmail.com>
> wrote:
>
>> What about the following pattern (labelled block + break)?
>>
>> ```js
>> processSuggestions: {
>> let suggestions;
>> try {
>> suggestions = await fetchSuggestions();
>> } catch (e) {
>> alert('Failed to load suggestions');
>> break processSuggestions;
>> }
>> showSuggestions(suggestions);
>> }
>> ```
>>
>> —Claude
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
>
> --
> Cheers,
> --MarkM
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180208/cd72517f/attachment-0001.html>
More information about the es-discuss
mailing list