The idea isn't to make the second call's exceptions silent, it's not to catch them (i.e. let them propagate).
On 9 Feb 2018 2:46 p.m., Augusto Moura <[email protected]> wrote:
I see this operator quite confusing, in my opinion it's a best practice treat the functions (and errors) separately. If you want to ignore the second error you can even create a `silent` helper.--```jsconst treatedShowSuggestions = (suggs) => {try {showSuggestions(suggs);} catch (e) {
// treat error};
try {const suggestions = await fetchSuggestions();treatedShowSuggestions(suggestions);} catch (e) {alert('Failed to load suggestions');}
```or```jsconst silent = (fn) => {try {fn();} catch (e) {}};try {const suggestions = await fetchSuggestions();silent(() => showSuggestions(suggestions));} catch (e) {alert('Failed to load suggestions');}```This isn't even a workaround, it's just the right approach for what you want. If you wanna to evict the separated functions you can just inline the try/catch in the main function.Augusto Moura
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

