Re: [WebIDL] Exceptions

On Thu, Jul 7, 2011 at 12:47 PM, Ian Hickson <ian@hixie.ch> wrote:
> 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.

Ok, let me know once this has been resolved and we can remove this
from the list of arguments at that time.

>> 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?

Don't know. Are there ones that can be thrown by the DOM 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.

This is an attempt to fix this problem. We're already in the state
where we have two different exception systems. This is an attempt to
create just one. The one used by ES. I'm definitely not suggesting
that the existing exceptions thrown by various specs should *not* have
a .name and should not inherit Exception. I think all exceptions
should be changed to follow that model.

/ Jonas

Received on Thursday, 7 July 2011 20:05:47 UTC