Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Close #983 Better JSON.parse error detection
Browse files Browse the repository at this point in the history
Previous pattern would only catch ILLEGAL, not { or other
known-but-unexpected JSON tokens.
  • Loading branch information
isaacs committed Apr 26, 2011
1 parent 68c8a69 commit bbffd9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ function REPLServer(prompt, stream) {
// It could also be an error from JSON.parse
} else if (e &&
e.stack &&
e.stack.match('Unexpected token ILLEGAL') &&
e.stack.match(/Object.parse \(native\)/)) {
e.stack.match(/^SyntaxError: Unexpected token .*\n/) &&
e.stack.match(/\n at Object.parse \(native\)\n/)) {
throw e;
}
}
Expand Down

0 comments on commit bbffd9e

Please sign in to comment.