mirror of https://github.com/nodejs/node.git
Close #983 Better JSON.parse error detection
Previous pattern would only catch ILLEGAL, not { or other known-but-unexpected JSON tokens.pull/22966/head
parent
68c8a69f4c
commit
bbffd9e502
|
@ -184,8 +184,8 @@ function REPLServer(prompt, stream) {
|
||||||
// It could also be an error from JSON.parse
|
// It could also be an error from JSON.parse
|
||||||
} else if (e &&
|
} else if (e &&
|
||||||
e.stack &&
|
e.stack &&
|
||||||
e.stack.match('Unexpected token ILLEGAL') &&
|
e.stack.match(/^SyntaxError: Unexpected token .*\n/) &&
|
||||||
e.stack.match(/Object.parse \(native\)/)) {
|
e.stack.match(/\n at Object.parse \(native\)\n/)) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue