[XML-SIG] Specializing DOM exceptions

Paul Prescod paul@prescod.net
Tue, 05 Dec 2000 03:58:58 -0500


Sorry for being long-delayed in writing this.

"Martin v. Loewis" wrote:
> 
> I'd like to propose an enhancement to the DOM exception classes,
> namely that different codes are mapped to different subclasses:
> 
> class IndexSizeErr(DOMException):
>       code = INDEX_SIZE_ERR

> Also, I'd like to make DOMException, the code constants, and the
> derived classes part of the official Python API, so all DOM
> implementations use the same set of exceptions.

My concern is that Python already has an IndexError and it is raised
"naturally" (and efficiently) in a lot of places in minidom. At one
point we had talked about formalizing a mechanism where Python
exceptions stand for DOM exceptions.

So IndexSizeErr could be a subclass of Python's IndexError. Python
"clients" could check for IndexError as they would in any other Python
code. Those that want to treat the DOM stuff specially could do so. This
would all be part of the Python-DOM mapping.

 Paul Prescod