Re-use the caught exception's error message in the parse error call.
authorChris Cowan <agentme49@gmail.com>
Thu, 14 May 2015 19:27:56 +0000 (12:27 -0700)
committerRichard van Velzen <rvanvelzen@experty.com>
Wed, 29 Jul 2015 13:06:52 +0000 (15:06 +0200)
lib/parse.js

index 70ee2e8..ab72ad2 100644 (file)
@@ -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) {