W3C home > Mailing lists > Public > www-svg@w3.org > April 2012

replacing SVGException with new style Web IDL exceptions

From: Cameron McCormack <cam@mcc.id.au>
Date: Tue, 10 Apr 2012 11:42:27 +1000
Message-ID: <4F839003.6080904@mcc.id.au>
To: SVG public list <www-svg@w3.org>
We will need to have SVG 2 use new style Web IDL exceptions.  For 
DOMExceptions, the DOM Core spec already defines the relevant exception 
types, so we can just link to those.  I think we should get rid of 
SVGException seeing as it doesn't expose any exception members other 
than "code", just like DOMException.

The only two codes of SVGException that are in use in the spec are 
SVG_INVALID_VALUE_ERR and SVG_MATRIX_NOT_INVERTABLE (sic).  Here are my 
suggestions for replacing them:

* Where SVG_INVALID_VALUE_ERR is used for a malformed DOMString value,
   such as operations like setPaint on SVGPaint (which we might not even
   keep, given it's a DOM 2 Style thing) we should throw a SyntaxError.

* Where SVG_INVALID_VALUE_ERR is used for an out of range integer
   enumeration or float, like SVGMatrix.rotateFromVector, we should
   throw a RangeError.

* Where SVG_MATRIX_NOT_INVERTABLE is thrown
   (SVGLocatable.getTransformToElement and SVGMatrix.inverse), we should
   throw a DOMException of type "InvalidStateError".

I very much doubt anyone is relying on the specific code values or their 
being SVGException objects here.
Received on Tuesday, 10 April 2012 01:43:02 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:50 GMT