[DOMError]: Subclassing DOMError to increase granularity of error handling?

Dear DOM experts,

I am a member of the System Applications WG and editor for the Raw Socket API specification, http://www.w3.org/2012/sysapps/raw-sockets/.

We have had a discussion on error handling, https://github.com/sysapps/raw-sockets/issues/18.

The basic problem with error handling is that with the standard DOMError interface the granularity of machine readable error names are too limited. An example is when the attempt to create a TCP socket fails. The reason can for example be "no network contact"," peer does not respond" and "local address/port pair is already in use". The available DOM error names does not make it possible to separate these error reasons and the only sensible error name for all these situations is "NetworkError".

I assume that this is a problem that can apply to other specifications as well.

The approach I have taken in the Raw Socket API is a subclass of DOMError called SocketError that adds an attribute "type" that details the error in addition to the error names defined for DOMError.

WDYT about this approach? Is this a reasonable solution?

Best regards

Claes Nilsson M.Sc.E.E
Master Engineer - Web Research
Advanced Application Labs

Sony Mobile Communications
Tel: +46 705 56 68 78
sonymobile.com<http://sonymobile.com/>

[cid:image001.jpg@01CE9293.6257C490]

Received on Tuesday, 6 August 2013 09:25:06 UTC