Name

DOMException — an exception thrown by a Web API

Synopsis

Most client-side JavaScript APIs throw DOMException objects when they need to signal an error. The code and name properties of the object provide more details about the error. Note that a DOMException can be thrown when reading or writing a property of an object as well as when calling a method of an object.

DOMException is not a subclass of the core JavaScript Error type, but it functions like one, and some browsers include a message property for compatibility with Error.

Constants

unsigned short INDEX_SIZE_ERR = 1unsigned short HIERARCHY_REQUEST_ERR = 3unsigned short WRONG_DOCUMENT_ERR = 4unsigned short INVALID_CHARACTER_ERR = 5unsigned short NO_MODIFICATION_ALLOWED_ERR = 7unsigned short NOT_FOUND_ERR = 8unsigned short NOT_SUPPORTED_ERR = 9unsigned short INVALID_STATE_ERR = 11unsigned short SYNTAX_ERR = 12unsigned short INVALID_MODIFICATION_ERR = 13unsigned short NAMESPACE_ERR = 14unsigned short INVALID_ACCESS_ERR = 15unsigned short TYPE_MISMATCH_ERR = 17unsigned short SECURITY_ERR = 18unsigned short NETWORK_ERR = 19unsigned short ABORT_ERR = 20unsigned short URL_MISMATCH_ERR = 21unsigned short QUOTA_EXCEEDED_ERR = 22unsigned short TIMEOUT_ERR = 23unsigned short DATA_CLONE_ERR = 25

These are the possible values of the code property. The constant names are verbose enough to indicate the approximate reason that the exception was thrown.

Properties

unsigned short code

One of the constant values listed above, indicating what type ...

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.