diff options
author | Nathan Rajlich <nathan@tootallnate.net> | 2012-09-22 05:46:16 +0400 |
---|---|---|
committer | Nathan Rajlich <nathan@tootallnate.net> | 2012-09-22 06:49:29 +0400 |
commit | 4a2670740c0e8cb4831c2c089cc7de7337a55e80 (patch) | |
tree | c8ec6296528f63d1e95987db6663b3f6c4ec0ad7 /lib | |
parent | f536eb176b0b4d167d2d34357a12a83a30c71c97 (diff) |
repl: make invalid RegExps throw in the REPL
Fixes #2746.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/repl.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/repl.js b/lib/repl.js index 98c14e73445..fcb9c1f32fc 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -271,6 +271,9 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) { // Convert error to string e = e && (e.stack || e.toString()); return e && e.match(/^SyntaxError/) && + // RegExp syntax error + !e.match(/^SyntaxError: Invalid regular expression/) && + // JSON.parse() error !(e.match(/^SyntaxError: Unexpected token .*\n/) && e.match(/\n at Object.parse \(native\)\n/)); } |