Home to Document Object Model | Up to Core
Next DOMImplementation


DOMException
Object

DOMException makes use of the implementation's exception handling model. (Where this is not suitable, the implementation should provide an alternative means of indicating the exception.) In ECMAScript, the try/catch construct can be used.

A DOMException will be raised where an operation is impossible to perform. The list below can be extended by the implementation for implementation-specific exceptions.

ExceptionCode
Attribute
ECMAScript binding: code (Number)

ExceptionCode identifies the exception condition. DOM Level 2 defines the following ExceptionCode constants (bound as attributes of DOMException in ECMAScript):

  • DOMSTRING_SIZE_ERR. . . . . - trying to make a DOMString that's too long.
  • HIERARCHY_REQUEST_ERR . . . - trying to insert a node in the wrong place.
  • INDEX_SIZE_ERR. . . . . . . - trying to index outside an array (or list of nodes, etc).
  • INUSE_ATTRIBUTE_ERR . . . . - trying to add an attribute that is in use.
  • INVALID_ACCESS_ERR. . . . . - trying to access an attribute or method that the (underlying) object doesn't provide.
  • INVALID_CHARACTER_ERR . . . - trying to use a character that is illegal in this context.
  • INVALID_MODIFICATION_ERR. . - trying to modify the type of the underlying object.
  • INVALID_STATE_ERR . . . . . - trying to use an object that is not/no longer usable.
  • NAMESPACE_ERR . . . . . . . - trying to do something that violates namespace rules.
  • NOT_FOUND_ERR . . . . . . . - trying to access a node that doesn't exist (in this context).
  • NOT_SUPPORTED_ERR . . . . . - trying to access a feature that this DOMImplementation does not support.
  • NO_DATA_ALLOWED_ERR . . . . - trying to specify data for a node that doesn't allow it.
  • NO_MODIFICATION_ALLOWED_ERR - trying to modify an object that doesn't allow it.
  • SYNTAX_ERR. . . . . . . . . - trying to use an illegal (in this context) string.
  • WRONG_DOCUMENT_ERR. . . . . - trying to use a node that isn't supported by this document.

Log in or registerto write something here or to contact authors.