RangeException | NN n/a IE n/a DOM 2
Some operations on W3C DOM Range objects can trigger errors, or, in the vernacular of JavaScript 1.5, throw exceptions if something goes wrong. The W3C DOM defines an object that conveys a code number corresponding to a well-defined, if somewhat limited, list of exceptions specifically related to Range objects. For example, if you attempt to set range boundaries to encompass non-content-related nodes (such as an Attr node), the selectNode( ) method with such a node as a parameter throws an exception whose code number is 2. This number corresponds to the exception that signals an attempt to perform an illegal or logically impossible action on a text range.
When eventually implemented in browsers, the scripting mechanism to work with range exceptions should be the same as described for the DOMException object. Range object property and method access can also throw DOMExceptions.
Object Model Reference
    errorObjectReference
Object-Specific Properties
code
Object-Specific Methods
None.
Object-Specific Event Handler Properties
None.

code | NN n/a IE n/a DOM 1
| Read-only
Provides the integer corresponding to one of the defined Range object error types, as shown in the following table.
Code | Constant | Most Likely Cause
--- | --- | ---
1 | BAD_BOUNDARYPOINTS_ERR | The surroundContents( ) method was applied to a range with a nonapplicable end point
2 | INVALID_NODE_TYPE_ERR | The method tried to work in a nonapplicable type of node
Value
Integer
Default
Determined by error.