Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNathan Rajlich <nathan@tootallnate.net>2012-09-22 05:46:16 +0400
committerNathan Rajlich <nathan@tootallnate.net>2012-09-22 06:49:29 +0400
commit4a2670740c0e8cb4831c2c089cc7de7337a55e80 (patch)
treec8ec6296528f63d1e95987db6663b3f6c4ec0ad7 /lib
parentf536eb176b0b4d167d2d34357a12a83a30c71c97 (diff)
repl: make invalid RegExps throw in the REPL
Fixes #2746.
Diffstat (limited to 'lib')
-rw-r--r--lib/repl.js3
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/));
}