diff --git a/src/util/SyntaxError.js b/src/util/SyntaxError.js index eec3039c..edcba8c5 100644 --- a/src/util/SyntaxError.js +++ b/src/util/SyntaxError.js @@ -8,6 +8,8 @@ * @param {int} col The column at which the error occurred. */ function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; /** * The column at which the error occurred. @@ -33,4 +35,5 @@ function SyntaxError(message, line, col){ } //inherit from Error -SyntaxError.prototype = new Error(); \ No newline at end of file +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line