files/en-us/web/api/domexception/index.md
{{APIRef("DOM")}}{{AvailableInWorkers}}
The 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 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.
DOMException is a {{Glossary("Serializable object")}}, so it can be cloned with {{DOMxRef("Window.structuredClone", "structuredClone()")}} or copied between Workers using {{domxref("Worker.postMessage()", "postMessage()")}}.
DOMException object with a specified message and name.0 if none match.Common error names are listed here. Some APIs define their own sets of names, so this is not necessarily a complete list.
The following deprecated historical errors don't have an error name but instead have only a legacy constant code value and a legacy constant name:
2, legacy constant name: DOMSTRING_SIZE_ERR6, legacy constant name: NO_DATA_ALLOWED_ERR16, legacy constant name: VALIDATION_ERR[!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.
IndexSizeError
1 and legacy constant name: INDEX_SIZE_ERR)HierarchyRequestError
3 and legacy constant name: HIERARCHY_REQUEST_ERR)WrongDocumentError
4 and legacy constant name: WRONG_DOCUMENT_ERR)InvalidCharacterError
5 and legacy constant name: INVALID_CHARACTER_ERR)NoModificationAllowedError
7 and legacy constant name: NO_MODIFICATION_ALLOWED_ERR)NotFoundError
8 and legacy constant name: NOT_FOUND_ERR)NotSupportedError
9 and legacy constant name: NOT_SUPPORTED_ERR)InUseAttributeError
10 and legacy constant name: INUSE_ATTRIBUTE_ERR)InvalidStateError
11 and legacy constant name: INVALID_STATE_ERR)SyntaxError
12 and legacy constant name: SYNTAX_ERR)InvalidModificationError
13 and legacy constant name: INVALID_MODIFICATION_ERR)NamespaceError
14 and legacy constant name: NAMESPACE_ERR)InvalidAccessError
15 and legacy constant name: INVALID_ACCESS_ERR)TypeMismatchError {{deprecated_inline}}
17 and legacy constant name: TYPE_MISMATCH_ERR) This value is deprecated; the JavaScript {{jsxref("TypeError")}} exception is now raised instead of a DOMException with this value.SecurityError
18 and legacy constant name: SECURITY_ERR)NetworkError {{experimental_inline}}
19 and legacy constant name: NETWORK_ERR)AbortError {{experimental_inline}}
20 and legacy constant name: ABORT_ERR)URLMismatchError {{experimental_inline}}
21 and legacy constant name: URL_MISMATCH_ERR)22 and legacy constant name: QUOTA_EXCEEDED_ERR) It is a proper interface that derives from DOMException.TimeoutError
23 and legacy constant name: TIMEOUT_ERR)InvalidNodeTypeError {{experimental_inline}}
24 and legacy constant name: INVALID_NODE_TYPE_ERR)DataCloneError {{experimental_inline}}
25 and legacy constant name: DATA_CLONE_ERR)EncodingError {{experimental_inline}}
NotReadableError {{experimental_inline}}
UnknownError {{experimental_inline}}
ConstraintError {{experimental_inline}}
DataError {{experimental_inline}}
TransactionInactiveError {{experimental_inline}}
ReadOnlyError {{experimental_inline}}
VersionError {{experimental_inline}}
OperationError {{experimental_inline}}
NotAllowedError
{{Specifications}}
{{Compat}}
DOMException is available in core-js