# DOMException

public class **DOMException** extends [RuntimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimeException.html)  
DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
when an operation is impossible to perform (either for logical reasons,
because data is lost, or because the implementation has become unstable).
In general, DOM methods return specific error values in ordinary
processing situations, such as out-of-bound errors when using
`NodeList`.

Implementations should raise other exceptions under other circumstances.
For example, implementations should raise an implementation-dependent
exception if a `null` argument is passed when `null`
was not expected.

Some languages and object systems do not support the concept of
exceptions. For such systems, error conditions may be indicated using
native error reporting mechanisms. For some bindings, for example,
methods may return error codes similar to those listed in the
corresponding method descriptions.

See also the [Document Object Model (DOM) Level 3 Core Specification](http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407).

### Constant Summary

|---|---|---|
| short | [DOMSTRING_SIZE_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#DOMSTRING_SIZE_ERR) | If the specified range of text does not fit into a `DOMString`. |
| short | [HIERARCHY_REQUEST_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#HIERARCHY_REQUEST_ERR) | If any `Node` is inserted somewhere it doesn't belong. |
| short | [INDEX_SIZE_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INDEX_SIZE_ERR) | If index or size is negative, or greater than the allowed value. |
| short | [INUSE_ATTRIBUTE_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INUSE_ATTRIBUTE_ERR) | If an attempt is made to add an attribute that is already in use elsewhere. |
| short | [INVALID_ACCESS_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INVALID_ACCESS_ERR) | If a parameter or an operation is not supported by the underlying object. |
| short | [INVALID_CHARACTER_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INVALID_CHARACTER_ERR) | If an invalid or illegal character is specified, such as in an XML name. |
| short | [INVALID_MODIFICATION_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INVALID_MODIFICATION_ERR) | If an attempt is made to modify the type of the underlying object. |
| short | [INVALID_STATE_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#INVALID_STATE_ERR) | If an attempt is made to use an object that is not, or is no longer, usable. |
| short | [NAMESPACE_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#NAMESPACE_ERR) | If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces. |
| short | [NOT_FOUND_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#NOT_FOUND_ERR) | If an attempt is made to reference a `Node` in a context where it does not exist. |
| short | [NOT_SUPPORTED_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#NOT_SUPPORTED_ERR) | If the implementation does not support the requested type of object or operation. |
| short | [NO_DATA_ALLOWED_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#NO_DATA_ALLOWED_ERR) | If data is specified for a `Node` which does not support data. |
| short | [NO_MODIFICATION_ALLOWED_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#NO_MODIFICATION_ALLOWED_ERR) | If an attempt is made to modify an object where modifications are not allowed. |
| short | [SYNTAX_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#SYNTAX_ERR) | If an invalid or illegal string is specified. |
| short | [TYPE_MISMATCH_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#TYPE_MISMATCH_ERR) | If the type of an object is incompatible with the expected type of the parameter associated to the object. |
| short | [VALIDATION_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#VALIDATION_ERR) | If a call to a method such as `insertBefore` or `removeChild` would make the `Node` invalid with respect to "partial validity", this exception would be raised and the operation would not be done. |
| short | [WRONG_DOCUMENT_ERR](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#WRONG_DOCUMENT_ERR) | If a `Node` is used in a different document than the one that created it (that doesn't support it). |

### Field Summary

|---|---|---|
| public short | [code](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#code) |   |

### Public Constructor Summary

|---|---|
|   | [DOMException](https://developers.google.com/j2objc/javadoc/jre/reference/org/w3c/dom/DOMException.html#DOMException(short,%20java.lang.String))(short code, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message) |

### Inherited Method Summary

From class [java.lang.Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)

|---|---|
| synchronized final void | [addSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) exception) Appends the specified exception to the exceptions that were suppressed in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [fillInStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#fillInStackTrace())() Fills in the execution stack trace. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause())() Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocalizedMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getLocalizedMessage())() Creates a localized description of this throwable. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getMessage())() Returns the detail message string of this throwable. |
| StackTraceElement\[\] | [getStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace())() Provides programmatic access to the stack trace information printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()`. |
| synchronized final [Throwable\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getSuppressed())() Returns an array containing all of the exceptions that were suppressed, typically by the `try`-with-resources statement, in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [initCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#initCause(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Initializes the *cause* of this throwable to the specified value. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace())() Prints this throwable and its backtrace to the standard error stream. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter))([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s) Prints this throwable and its backtrace to the specified print writer. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream))([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s) Prints this throwable and its backtrace to the specified print stream. |
| void | [setStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[]))(StackTraceElement\[\] stackTrace) Sets the stack trace elements that will be returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace()` and printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()` and related methods. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#toString())() Returns a short description of this throwable. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Constants

#### public static final short
**DOMSTRING_SIZE_ERR**

If the specified range of text does not fit into a
`DOMString`.
Constant Value: 2

#### public static final short
**HIERARCHY_REQUEST_ERR**

If any `Node` is inserted somewhere it doesn't belong.
Constant Value: 3

#### public static final short
**INDEX_SIZE_ERR**

If index or size is negative, or greater than the allowed value.
Constant Value: 1

#### public static final short
**INUSE_ATTRIBUTE_ERR**

If an attempt is made to add an attribute that is already in use
elsewhere.
Constant Value: 10

#### public static final short
**INVALID_ACCESS_ERR**

If a parameter or an operation is not supported by the underlying
object.
Constant Value: 15

#### public static final short
**INVALID_CHARACTER_ERR**

If an invalid or illegal character is specified, such as in an XML name.
Constant Value: 5

#### public static final short
**INVALID_MODIFICATION_ERR**

If an attempt is made to modify the type of the underlying object.
Constant Value: 13

#### public static final short
**INVALID_STATE_ERR**

If an attempt is made to use an object that is not, or is no longer,
usable.
Constant Value: 11

#### public static final short
**NAMESPACE_ERR**

If an attempt is made to create or change an object in a way which is
incorrect with regard to namespaces.
Constant Value: 14

#### public static final short
**NOT_FOUND_ERR**

If an attempt is made to reference a `Node` in a context
where it does not exist.
Constant Value: 8

#### public static final short
**NOT_SUPPORTED_ERR**

If the implementation does not support the requested type of object or
operation.
Constant Value: 9

#### public static final short
**NO_DATA_ALLOWED_ERR**

If data is specified for a `Node` which does not support
data.
Constant Value: 6

#### public static final short
**NO_MODIFICATION_ALLOWED_ERR**

If an attempt is made to modify an object where modifications are not
allowed.
Constant Value: 7

#### public static final short
**SYNTAX_ERR**

If an invalid or illegal string is specified.
Constant Value: 12

#### public static final short
**TYPE_MISMATCH_ERR**

If the type of an object is incompatible with the expected type of the
parameter associated to the object.
Constant Value: 17

#### public static final short
**VALIDATION_ERR**

If a call to a method such as `insertBefore` or
`removeChild` would make the `Node` invalid
with respect to "partial validity", this exception would be raised
and the operation would not be done. This code is used in \[[DOM Level 3 Validation](http://www.w3.org/TR/2004/REC-DOM-Level-3-Val-20040127/)\]
. Refer to this specification for further information.
Constant Value: 16

#### public static final short
**WRONG_DOCUMENT_ERR**

If a `Node` is used in a different document than the one
that created it (that doesn't support it).
Constant Value: 4

## Fields

#### public short
**code**

<br />

## Public Constructors

#### public
**DOMException**
(short code, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message)

<br />

##### Parameters

| code |   |
| message |   |
|---|---|