From W3C Wiki
< DOM‎ | domcore
Jump to: navigation, search


DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when using NodeList.


Code Constant Description
1 INDEX_SIZE_ERR the index is not in the allowed range
2 DOMSTRING_SIZE_ERR the text does not fit in a DOMString
3 HIERARCHY_REQUEST_ERR the operation would yield an incorrect nodes model
4 WRONG_DOCUMENT_ERR the object is in the wrong Document, a call to importNode is required
5 INVALID_CHARACTER_ERR the string contains invalid characters
6 NO_DATA_ALLOWED_ERR data is specified for an object that does not support it (historical)
7 NO_MODIFICATION_ALLOWED_ERR the object can not be modified
8 NOT_FOUND_ERR the object can not be found here
9 NOT_SUPPORTED_ERR this operation is not supported
10 INUSE_ATTRIBUTE_ERR the attribute is in use (historical)
11 INVALID_STATE_ERR the object is in an invalid state
12 SYNTAX_ERR the string did not match the expected pattern
13 INVALID_MODIFICATION_ERR the object can not be modified in this way
14 NAMESPACE_ERR the operation is not allowed by Namespaces in XML
15 INVALID_ACCESS_ERR the object does not support the operation or argument
16 VALIDATION_ERR the operation is invalid (historical)
17 TYPE_MISMATCH_ERR the type of the object does not match the expected type
18 SECURITY_ERR the operation is insecure
19 NETWORK_ERR a network error occurred
20 ABORT_ERR the user aborted an operation
21 URL_MISMATCH_ERR the given URL does not match another URL
22 QUOTA_EXCEEDED_ERR the quota has been exceeded
23 TIMEOUT_ERR a timeout occurred
24 INVALID_NODE_TYPE_ERR the supplied node is invalid or has an invalid ancestor for this operation
25 DATA_CLONE_ERR the object can not be cloned

DOM Core reference

DOM Core specification defines the DOMException in 3.1 Exception DOMException.