[Need Champion] Catch guards

Proposal: GitHub - jeengbe/proposal-catch-guards

The document proposes a new syntax for catch clauses with guards for better code readability:

try {
  someFunction();
} catch ErrorA (err) {
  // Do something
} catch ErrorB | ErrorC (err) {
  // Do another thing
} catch {
  // Do a third thing
} finally {
  // Clean up
}

The proposal is in need of a champion and a polished changeset to the spec.

This is commonly called catch guards, and there’s an existing proposal that’s planning to follow up pattern matching.

Proposal mentioned above: GitHub - wmsbill/proposal-catch-guards: TC39 proposal for catch guards

Hi @ljharb, @senocular,

thanks for your comments. I have updated the proposal accordingly and added a section that compares the document with other proposals.

I wouldn’t support anything that has instanceof semantics, because instanceof is not reliable or robust.