Conditional catch clause

Brendan Eich brendan at
Wed Dec 19 11:08:32 PST 2012

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).


More information about the es-discuss mailing list