Merge pull request #347 from mbaumgartl/errorstack

Add stack trace in engines based on V8
redux
David Majda 9 years ago
commit 5e6b5da4e9

@ -782,8 +782,11 @@ function generateJavascript(ast, options) {
' this.expected = expected;',
' this.found = found;',
' this.location = location;',
'',
' this.name = "SyntaxError";',
'',
' if (typeof Error.captureStackTrace === "function") {',
' Error.captureStackTrace(this, peg$SyntaxError);',
' }',
' }',
'',
' peg$subclass(peg$SyntaxError, Error);',

@ -7,6 +7,10 @@ function GrammarError(message, location) {
this.name = "GrammarError";
this.message = message;
this.location = location;
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, GrammarError);
}
}
classes.subclass(GrammarError, Error);

@ -18,8 +18,11 @@ module.exports = (function() {
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);

Loading…
Cancel
Save