I'd still prefer we wait until pattern matching [1] gets addressed first, then tackling this. Error types are represented about 50 different ways in JS, with subtyping only being one (used by the standard kind of). Node appends an `err.code`, and the DOM adds a similar type, just using a common error subclass. And in some cases where errors are planned (but exceptions are more convenient), you sometimes see non-errors thrown. So there needs to be a means of catching all of them, and `if` checks get verbose and noisy in a hurry.
On Wed, Apr 25, 2018, 00:11 Ayush Gupta <ayushg3...@gmail.com> wrote: > We could potentially provide the same functionality in `try/catch` by > extending the signature of `catch` to > > ```js > try { > > } catch(<expression_var>, <function_expression>) { > > } > ``` > > If `<function_expression>` evaluates to truthy, invoke the `catch` block, > otherwise don't. > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss