A few questions and suggestions.

Michael Daumling mdaeumli at adobe.com
Sun Apr 29 20:24:15 PDT 2007


Hi Thiago,

Just a quick word about this:

>>*** Exceptions
>>
>>Currently, I really miss the ability to catch exceptions given it's
type. In the new ES spec, will the following code be possible?

>>Try {  ... }
>>catch(e : TypeError) {  ... }
>>catch(e : ReferenceError) {  ... }

The correct syntax is in today's SpiderMonkey implementation already,
and it goes like this:

try {...}
catch (e if e instanceof TypeError) { ... }

In short: JavaScript supports conditional catches, and you can, of
course, check the type of an error this way.

Michael



More information about the Es4-discuss mailing list