Re: [WebIDL] Exceptions

On Thu, 7 Jul 2011, Jonas Sicking wrote:
> 
> It's a pain since it forces us to try to coordinate codes across
> multiple specifications, working groups and standards organizations.

Anything that allows us to _not_ coordinate is an epic disaster, IMHO.

We absolutely should be coordinating. How else can we ensure the platform 
is a consistent platform?

This is a feature, not a bug.


> And even if this coordinating somehow started magically working, it 
> still means that exceptions thrown by the DOM needs to be checked 
> differently than exceptions thrown by ES. So you'll end up having to do:

Are there exceptions that can be legitimately thrown by JS that aren't 
programming bugs?


> Lastly, the syntax:
> if (ex.name === "HierarchyRequestError") { ... }
> is a lot easier on the eyes than:
> if (ex.code === DOMException.HIERARCHY_REQUEST_ERR) { ... }
> IMHO.

I've no problem with adding names to all the current exceptions, if we 
want to do that. (I generally am averse to using strings for values, since 
they don't syntax check well, but in JS that game is somewhat lost in the 
above scenario anyway, so whatever.)

My concern is with having newer parts of the platform use entirely 
different models (e.g. new exception interfaces) relative to older parts 
of the platform (which e.g. use codes). It leads to the kind of problem 
you describe with JS vs DOM, except that we'd have JS vs DOM vs new DOM vs 
even new DOM, etc.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 7 July 2011 19:47:40 UTC