Skip to content

Commit

Permalink
Add stack traces (at least in V8) and messages to DOMExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
aredridel committed Aug 26, 2010
1 parent e9f3ff6 commit 20e006f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/jsdom/level1/core.js
Expand Up @@ -50,6 +50,9 @@ var sys = require("sys");


core.DOMException = function(code) { core.DOMException = function(code) {
this._code = code; this._code = code;
Error.call(this, messages[code]);
this.message = messages[code];
if(Error.captureStackTrace) Error.captureStackTrace(this, core.DOMException);
}; };


core.DOMException.prototype = { core.DOMException.prototype = {
Expand All @@ -70,6 +73,18 @@ var NOT_FOUND_ERR = core.NOT_FOUND_ERR = 8;
var NOT_SUPPORTED_ERR = core.NOT_SUPPORTED_ERR = 9; var NOT_SUPPORTED_ERR = core.NOT_SUPPORTED_ERR = 9;
var INUSE_ATTRIBUTE_ERR = core.INUSE_ATTRIBUTE_ERR = 10; var INUSE_ATTRIBUTE_ERR = core.INUSE_ATTRIBUTE_ERR = 10;


var messages = {}
messages[INDEX_SIZE_ERR] = "Index size error";
messages[DOMSTRING_SIZE_ERR] = "DOMString size error";
messages[HIERARCHY_REQUEST_ERR] = "Heirarchy request error";
messages[WRONG_DOCUMENT_ERR] = "Wrong document";
messages[INVALID_CHARACTER_ERR] = "Invalid character";
messages[NO_DATA_ALLOWED_ERR] = "No data allowed";
messages[NO_MODIFICATION_ALLOWED_ERR] = "No modification allowed";
messages[NOT_FOUND_ERR] = "Not found";
messages[NOT_SUPPORTED_ERR] = "Not supported";
messages[INUSE_ATTRIBUTE_ERR] = "Attribute in use";

core.NodeList = function(document, element, tagName) { core.NodeList = function(document, element, tagName) {
this._document = document; this._document = document;
this._element = element; this._element = element;
Expand Down

0 comments on commit 20e006f

Please sign in to comment.