Table of Contents

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

See also on MDN

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

message string
name string

Remarks

Fields

ABORT_ERR

[Value("ABORT_ERR")]
public const ushort ABORT_ERR = 20

Field Value

ushort

DATA_CLONE_ERR

[Value("DATA_CLONE_ERR")]
public const ushort DATA_CLONE_ERR = 25

Field Value

ushort

DOMSTRING_SIZE_ERR

[Value("DOMSTRING_SIZE_ERR")]
public const ushort DOMSTRING_SIZE_ERR = 2

Field Value

ushort

HIERARCHY_REQUEST_ERR

[Value("HIERARCHY_REQUEST_ERR")]
public const ushort HIERARCHY_REQUEST_ERR = 3

Field Value

ushort

INDEX_SIZE_ERR

[Value("INDEX_SIZE_ERR")]
public const ushort INDEX_SIZE_ERR = 1

Field Value

ushort

INUSE_ATTRIBUTE_ERR

[Value("INUSE_ATTRIBUTE_ERR")]
public const ushort INUSE_ATTRIBUTE_ERR = 10

Field Value

ushort

INVALID_ACCESS_ERR

[Value("INVALID_ACCESS_ERR")]
public const ushort INVALID_ACCESS_ERR = 15

Field Value

ushort

INVALID_CHARACTER_ERR

[Value("INVALID_CHARACTER_ERR")]
public const ushort INVALID_CHARACTER_ERR = 5

Field Value

ushort

INVALID_MODIFICATION_ERR

[Value("INVALID_MODIFICATION_ERR")]
public const ushort INVALID_MODIFICATION_ERR = 13

Field Value

ushort

INVALID_NODE_TYPE_ERR

[Value("INVALID_NODE_TYPE_ERR")]
public const ushort INVALID_NODE_TYPE_ERR = 24

Field Value

ushort

INVALID_STATE_ERR

[Value("INVALID_STATE_ERR")]
public const ushort INVALID_STATE_ERR = 11

Field Value

ushort

NAMESPACE_ERR

[Value("NAMESPACE_ERR")]
public const ushort NAMESPACE_ERR = 14

Field Value

ushort

NETWORK_ERR

[Value("NETWORK_ERR")]
public const ushort NETWORK_ERR = 19

Field Value

ushort

NOT_FOUND_ERR

[Value("NOT_FOUND_ERR")]
public const ushort NOT_FOUND_ERR = 8

Field Value

ushort

NOT_SUPPORTED_ERR

[Value("NOT_SUPPORTED_ERR")]
public const ushort NOT_SUPPORTED_ERR = 9

Field Value

ushort

NO_DATA_ALLOWED_ERR

[Value("NO_DATA_ALLOWED_ERR")]
public const ushort NO_DATA_ALLOWED_ERR = 6

Field Value

ushort

NO_MODIFICATION_ALLOWED_ERR

[Value("NO_MODIFICATION_ALLOWED_ERR")]
public const ushort NO_MODIFICATION_ALLOWED_ERR = 7

Field Value

ushort

QUOTA_EXCEEDED_ERR

[Value("QUOTA_EXCEEDED_ERR")]
public const ushort QUOTA_EXCEEDED_ERR = 22

Field Value

ushort

SECURITY_ERR

[Value("SECURITY_ERR")]
public const ushort SECURITY_ERR = 18

Field Value

ushort

SYNTAX_ERR

[Value("SYNTAX_ERR")]
public const ushort SYNTAX_ERR = 12

Field Value

ushort

TIMEOUT_ERR

[Value("TIMEOUT_ERR")]
public const ushort TIMEOUT_ERR = 23

Field Value

ushort

TYPE_MISMATCH_ERR

[Value("TYPE_MISMATCH_ERR")]
public const ushort TYPE_MISMATCH_ERR = 17

Field Value

ushort

URL_MISMATCH_ERR

[Value("URL_MISMATCH_ERR")]
public const ushort URL_MISMATCH_ERR = 21

Field Value

ushort

VALIDATION_ERR

[Value("VALIDATION_ERR")]
public const ushort VALIDATION_ERR = 16

Field Value

ushort

WRONG_DOCUMENT_ERR

[Value("WRONG_DOCUMENT_ERR")]
public const ushort WRONG_DOCUMENT_ERR = 4

Field Value

ushort

Properties

Code

IMPORTANT
Deprecated
The code 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 0 if 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.

See also on MDN

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.

Remarks