From: Chris Cowan Date: Thu, 14 May 2015 19:27:56 +0000 (-0700) Subject: Re-use the caught exception's error message in the parse error call. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9854deb626874f06107db196b87afcf2dc49b035;p=UglifyJS.git Re-use the caught exception's error message in the parse error call. --- diff --git a/lib/parse.js b/lib/parse.js index 70ee2e80..ab72ad2d 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -480,13 +480,11 @@ function tokenizer($TEXT, filename, html5_comments) { regexp += ch; } var mods = read_name(); - var r; try { - r = new RegExp(regexp, mods); + return token("regexp", new RegExp(regexp, mods)); } catch(e) { - parse_error("Invalid regular expression"); + parse_error(e.message); } - return token("regexp", r); }); function read_operator(prefix) {