Skip to content

Commit

Permalink
Merge pull request #325 from RubenVerborgh/fix-error-inheritance
Browse files Browse the repository at this point in the history
_parseError should be an instance of Error
  • Loading branch information
zaach committed Apr 2, 2016
2 parents 6ecb980 + 3367ad1 commit 7653842
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/jison.js
Original file line number Diff line number Diff line change
Expand Up @@ -1359,13 +1359,9 @@ function parseError (str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
function _parseError (msg, hash) {
this.message = msg;
this.hash = hash;
}
_parseError.prototype = Error;

throw new _parseError(str, hash);
var error = new Error(str);
error.hash = hash;
throw error;
}
}

Expand Down

0 comments on commit 7653842

Please sign in to comment.