Class DOMException
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
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.
[Value("DOMException")]
public class DOMException
- Inheritance
-
DOMException
- Derived
- Inherited Members
Remarks
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 Window.StructuredClone or copied between Workers using PostMessage(dynamic, List<Object>).
-A polyfill of DOMException is available in core-js
-DOMError
Constructors
DOMException()
public DOMException()
DOMException(string, string)
The DOMException() constructor returns a
DOMException object with a specified message and name.
public DOMException(string message = null, string name = null)
Parameters
Remarks
-A polyfill of DOMException constructor is available in core-js
Fields
ABORT_ERR
[Value("ABORT_ERR")]
public const ushort ABORT_ERR = 20
Field Value
DATA_CLONE_ERR
[Value("DATA_CLONE_ERR")]
public const ushort DATA_CLONE_ERR = 25
Field Value
DOMSTRING_SIZE_ERR
[Value("DOMSTRING_SIZE_ERR")]
public const ushort DOMSTRING_SIZE_ERR = 2
Field Value
HIERARCHY_REQUEST_ERR
[Value("HIERARCHY_REQUEST_ERR")]
public const ushort HIERARCHY_REQUEST_ERR = 3
Field Value
INDEX_SIZE_ERR
[Value("INDEX_SIZE_ERR")]
public const ushort INDEX_SIZE_ERR = 1
Field Value
INUSE_ATTRIBUTE_ERR
[Value("INUSE_ATTRIBUTE_ERR")]
public const ushort INUSE_ATTRIBUTE_ERR = 10
Field Value
INVALID_ACCESS_ERR
[Value("INVALID_ACCESS_ERR")]
public const ushort INVALID_ACCESS_ERR = 15
Field Value
INVALID_CHARACTER_ERR
[Value("INVALID_CHARACTER_ERR")]
public const ushort INVALID_CHARACTER_ERR = 5
Field Value
INVALID_MODIFICATION_ERR
[Value("INVALID_MODIFICATION_ERR")]
public const ushort INVALID_MODIFICATION_ERR = 13
Field Value
INVALID_NODE_TYPE_ERR
[Value("INVALID_NODE_TYPE_ERR")]
public const ushort INVALID_NODE_TYPE_ERR = 24
Field Value
INVALID_STATE_ERR
[Value("INVALID_STATE_ERR")]
public const ushort INVALID_STATE_ERR = 11
Field Value
NAMESPACE_ERR
[Value("NAMESPACE_ERR")]
public const ushort NAMESPACE_ERR = 14
Field Value
NETWORK_ERR
[Value("NETWORK_ERR")]
public const ushort NETWORK_ERR = 19
Field Value
NOT_FOUND_ERR
[Value("NOT_FOUND_ERR")]
public const ushort NOT_FOUND_ERR = 8
Field Value
NOT_SUPPORTED_ERR
[Value("NOT_SUPPORTED_ERR")]
public const ushort NOT_SUPPORTED_ERR = 9
Field Value
NO_DATA_ALLOWED_ERR
[Value("NO_DATA_ALLOWED_ERR")]
public const ushort NO_DATA_ALLOWED_ERR = 6
Field Value
NO_MODIFICATION_ALLOWED_ERR
[Value("NO_MODIFICATION_ALLOWED_ERR")]
public const ushort NO_MODIFICATION_ALLOWED_ERR = 7
Field Value
QUOTA_EXCEEDED_ERR
[Value("QUOTA_EXCEEDED_ERR")]
public const ushort QUOTA_EXCEEDED_ERR = 22
Field Value
SECURITY_ERR
[Value("SECURITY_ERR")]
public const ushort SECURITY_ERR = 18
Field Value
SYNTAX_ERR
[Value("SYNTAX_ERR")]
public const ushort SYNTAX_ERR = 12
Field Value
TIMEOUT_ERR
[Value("TIMEOUT_ERR")]
public const ushort TIMEOUT_ERR = 23
Field Value
TYPE_MISMATCH_ERR
[Value("TYPE_MISMATCH_ERR")]
public const ushort TYPE_MISMATCH_ERR = 17
Field Value
URL_MISMATCH_ERR
[Value("URL_MISMATCH_ERR")]
public const ushort URL_MISMATCH_ERR = 21
Field Value
VALIDATION_ERR
[Value("VALIDATION_ERR")]
public const ushort VALIDATION_ERR = 16
Field Value
WRONG_DOCUMENT_ERR
[Value("WRONG_DOCUMENT_ERR")]
public const ushort WRONG_DOCUMENT_ERR = 4
Field Value
Properties
Code
IMPORTANT
Deprecatedcode read-only property of the DOMException interface returns one of the legacy error code constants, or 0 if none match.
[Value("code")]
public ushort Code { get; }
Property Value
- ushort
One of the error code constants, or
0if none match.
Remarks
This field is used for historical reasons. New DOM exceptions don't use this anymore: they put this info in the Name attribute.
Message
The message read-only property of the
DOMException interface returns a string representing
a message or description associated with the given error name.
[Value("message")]
public string Message { get; }
Property Value
- string
A string.
Remarks
Name
The name read-only property of the
DOMException interface returns a string that contains
one of the strings associated with an error name.
[Value("name")]
public string Name { get; }
Property Value
- string
A string.