Created
January 11, 2011 06:07
-
-
Save aredridel/774092 to your computer and use it in GitHub Desktop.
Exception inheritance from jsdom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
core.DOMException = function(code, message) { | |
this._code = code; | |
Error.call(this, core.exceptionMessages[code]); | |
this.message = core.exceptionMessages[code]; | |
if(message) this.message = this.message + ": " + message; | |
if(Error.captureStackTrace) Error.captureStackTrace(this, core.DOMException); | |
}; | |
core.DOMException.prototype = { | |
get code() { return this._code;}, | |
INDEX_SIZE_ERR : INDEX_SIZE_ERR, | |
DOMSTRING_SIZE_ERR : DOMSTRING_SIZE_ERR, | |
HIERARCHY_REQUEST_ERR : HIERARCHY_REQUEST_ERR, | |
WRONG_DOCUMENT_ERR : WRONG_DOCUMENT_ERR, | |
INVALID_CHARACTER_ERR : INVALID_CHARACTER_ERR, | |
NO_DATA_ALLOWED_ERR : NO_DATA_ALLOWED_ERR, | |
NO_MODIFICATION_ALLOWED_ERR : NO_MODIFICATION_ALLOWED_ERR, | |
NOT_FOUND_ERR : NOT_FOUND_ERR, | |
NOT_SUPPORTED_ERR : NOT_SUPPORTED_ERR, | |
INUSE_ATTRIBUTE_ERR : INUSE_ATTRIBUTE_ERR | |
}; | |
core.DOMException.prototype.__proto__ = Error.prototype; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment