--- title: DOMException slug: Web/API/DOMException translation_of: Web/API/DOMException ---
{{ APIRef("DOM") }}
A interface DOMException representa um evento anormal (denominado de exceção) durante a chamada ou a espera de um resultado do metodo ou uma solicitação a uma web API. Basicamente, falando, é o tratamento dos erros e condições, dos mesmos, nos processos web.
Cada exceção tem um nome, que é uma pequena string de estilo "CamelCase" que identifica o erro ou condição anormal.
DOMException object with a specified message and name.short that contains one of the {{anch("Error codes", "error code constants")}}, or 0 if none match. This field is used for historical reasons. New DOM exceptions don't use this anymore: they put this info in the {{domxref("DOMException.name")}} attribute.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 which 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.
IndexSizeError1 and legacy constant name: INDEX_SIZE_ERR)HierarchyRequestError3 and legacy constant name: HIERARCHY_REQUEST_ERR)WrongDocumentError4 and legacy constant name: WRONG_DOCUMENT_ERR)InvalidCharacterError5 and legacy constant name: INVALID_CHARACTER_ERR)NoModificationAllowedError7 and legacy constant name: NO_MODIFICATION_ALLOWED_ERR)NotFoundError8 and legacy constant name: NOT_FOUND_ERR)NotSupportedError9 and legacy constant name: NOT_SUPPORTED_ERR)InvalidStateError11 and legacy constant name: INVALID_STATE_ERR)SyntaxError12 and legacy constant name: SYNTAX_ERR)InvalidModificationError13 and legacy constant name: INVALID_MODIFICATION_ERR)NamespaceError14 and legacy constant name: NAMESPACE_ERR)InvalidAccessError15 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.SecurityError18 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)QuotaExceededError {{experimental_inline}}22 and legacy constant name: QUOTA_EXCEEDED_ERR)TimeoutError23 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| Specification | Status | Comment |
|---|---|---|
| {{SpecName('WebIDL', '#idl-DOMException', 'constructor')}} | {{Spec2('WebIDL')}} | Adds the constructor for the DOMException class. Adds the NotReadableError, UnknownError, ConstraintError, DataError, TransactionInactiveError, ReadOnlyError, VersionError, OperationError, and NotAllowedError values. |
| {{SpecName('DOM4', '#exception-domexception', 'DOMException')}} | {{Spec2('DOM4')}} | Added SECURITY_ERR, NETWORK_ERR, ABORT_ERR, URL_MISMATCH_ERR, QUOTA_EXCEEDED_ERR, TIMEOUT_ERR, INVALID_NODE_TYPE_ERR, and DATA_CLONE_ERR. The property code has been deprecated for exception values. The EncodingError value added. |
| {{SpecName('DOM3 Core', 'core.html#ID-17189187', 'DOMException')}} | {{Spec2('DOM3 Core')}} | Added of VALIDATION_ERR and TYPE_MISMATCH_ERR. |
| {{SpecName('DOM2 Core', 'core.html#ID-17189187', 'DOMException')}} | {{Spec2('DOM2 Core')}} | Added of INVALID_STATE_ERR, SYNTAX_ERR, INVALID_MODIFICATION_ERR, NAMESPACE_ERR, and INVALID_ACCESS_ERR. |
| {{SpecName('DOM1', 'level-one-core.html#ID-17189187', 'DOMException')}} | {{Spec2('DOM1')}} | Initial definition. |
{{Compat("api.DOMException")}}