XML DOM » Objects » DOMException

An exception is only raised in such unusual circumstances as when an operation is impossible to perform. This can happen for logical reasons, because data is lost or because the implementation has become unstable. In ordinary processing situations DOM methods generally return specific error values (e.g. out-of-bound errors when using a NodeList).

Specific implementations may raise other exceptions under other circumstances, such as passing a null argument.

Some languages and object systems do not support the concept of exceptions. In such cases error conditions may be indicated using native error-reporting mechanisms.

Error Types
Below is a list of the error type constants and the integers used to represent them.

    if index or size is negative, or greater than the allowed value
    if the specified range of text does not fit into a DOMString
    if any node is inserted where is does not belong
    if a node is used in a document other than the one that created it
    if an invalid character is specified, such as in a name
    if data is specified for a node that does not support data
    if an attempt is made to modify an object that does not allow modification
    if an attempt is made to reference a node in a context in which it does not exist
    if the implementation does not support the type of object requested
    if an attempt is made to add an attribute that is already in use elsewhere