try/catch/else

Mark Miller erights at gmail.com
Thu Feb 8 19:34:52 UTC 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180208/6265b692/attachment.html>


More information about the es-discuss mailing list