Skip to content

Commit

Permalink
Show generator exceptions as errors on try web page
Browse files Browse the repository at this point in the history
  • Loading branch information
techtonik committed Feb 8, 2016
1 parent 54fc181 commit db44303
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions assets/js/try.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ function processGrammar () {
}
}

Jison.print = function () {};
parser = Jison.Generator(cfg, {type: type});
//Jison.print = function () {};
try {
parser = Jison.Generator(cfg, {type: type});
} catch(e) {
$("#gen_out").text("Oops. Error while parsing grammar.\n"+e).addClass('bad');
throw(e);
}

$("#out").removeClass("good").removeClass("bad").html('');
$("#gen_out").removeClass("good").removeClass("bad");
Expand Down

0 comments on commit db44303

Please sign in to comment.