an operator for ignoring any exceptions

Claude Pache claude.pache at gmail.com
Mon Aug 14 08:01:55 UTC 2017


Note that, in a try/catch/finally construct, you can already omit the catch clause if there is a finally clause. The effect, of course, is not to swallow the exception, but, on the contrary, to propagate it as if there was `catch (e) { throw e }`. (The useful part of such a construct is the finally clause.)

Also, in languages and dialects supporting conditional catch clauses, if the thrown exception does not match the condition of any catch clause, it is propagated.

So, the rule is: If there a matching catch clause, the exception is handled by it; otherwise, it is propagated. Reversing that rule (“propagated” → “not propagated”) is very dubious, to start (regardless of any other consideration).

—Claude


More information about the es-discuss mailing list