DOMException interface represents an abnormal event (called an exception) that occurs as a result of calling a method or accessing a property of a web API. This is basically how error conditions are described in web APIs.
Each exception has a name, which is a short "PascalCase"-style string identifying the error or abnormal condition.
- Returns a
DOMExceptionobject with a specified message and name.
- Returns a
shortthat contains one of the error code constants, or
0if none match. This field is used for historical reasons. New DOM exceptions don't use this anymore: they put this info in the
- Returns a
DOMStringrepresenting a message or description associated with the given error name.
- Returns a
DOMStringthat contains one of the strings associated with an error name.
Common error names are listed here. Some APIs define their own sets of names, so this is not necessarily a complete list.
Note: Because historically the errors were identified by a numeric value that corresponded with a named variable defined to have that value, some of the entries below indicate the legacy code value and constant name that were used in the past.
- The index is not in the allowed range. For example, this can be thrown by the
Rangeobject. (Legacy code value:
1and legacy constant name:
- The node tree hierarchy is not correct. (Legacy code value:
3and legacy constant name:
- The object is in the wrong
Document. (Legacy code value:
4and legacy constant name:
- The string contains invalid characters. (Legacy code value:
5and legacy constant name:
- The object cannot be modified. (Legacy code value:
7and legacy constant name:
- The object cannot be found here. (Legacy code value:
8and legacy constant name:
- The operation is not supported. (Legacy code value:
9and legacy constant name:
- The object is in an invalid state. (Legacy code value:
11and legacy constant name:
- The string did not match the expected pattern. (Legacy code value:
12and legacy constant name:
- The object cannot be modified in this way. (Legacy code value:
13and legacy constant name:
- The operation is not allowed by Namespaces in XML. (Legacy code value:
14and legacy constant name:
- The object does not support the operation or argument. (Legacy code value:
15and legacy constant name:
- The type of the object does not match the expected type. (Legacy code value:
17and legacy constant name:
TypeErrorexception is now raised instead of a
DOMExceptionwith this value.
- The operation is insecure. (Legacy code value:
18and legacy constant name:
- A network error occurred. (Legacy code value:
19and legacy constant name:
- The operation was aborted. (Legacy code value:
20and legacy constant name:
- The given URL does not match another URL. (Legacy code value:
21and legacy constant name:
- The quota has been exceeded. (Legacy code value:
22and legacy constant name:
- The operation timed out. (Legacy code value:
23and legacy constant name:
- The node is incorrect or has an incorrect ancestor for this operation. (Legacy code value:
24and legacy constant name:
- The object can not be cloned. (Legacy code value:
25and legacy constant name:
- The encoding or decoding operation failed (No legacy code value and constant name).
- The input/output read operation failed (No legacy code value and constant name).
- The operation failed for an unknown transient reason (e.g. out of memory) (No legacy code value and constant name).
- A mutation operation in a transaction failed because a constraint was not satisfied (No legacy code value and constant name).
- Provided data is inadequate (No legacy code value and constant name).
- A request was placed against a transaction that is currently not active or is finished (No legacy code value and constant name).
- The mutating operation was attempted in a "readonly" transaction (No legacy code value and constant name).
- An attempt was made to open a database using a lower version than the existing version (No legacy code value and constant name).
- The operation failed for an operation-specific reason (No legacy code value and constant name).
- The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission (No legacy code value and constant name).
|WebIDL Level 1 (WebIDL 1)|
BCD tables only load in the browser