David Bruant wrote:
Le 19/12/2012 14:13, Claude Pache a écrit :
Hello,

In SpiderMonkey (and perhaps other JS engines?), there are conditional catch clauses:

    catch (exception if condition)

Could such a feature added to ECMAScript?

Rationale: Although try/catch mechanism was initially intended for treating errors, it could be used in normal control flow with non-error condition.
Why not just use normal control flow when you want to express non-error conditions?

Because you have to remember to re-throw in the "default" case (which is easy to forget).

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to