Throw error when Doug parser throws 'Unexpected'

This commit is contained in:
Andrey Gubanov
2017-06-05 19:55:27 +03:00
parent a4ff31cbf7
commit 094ff0d03d

View File

@@ -421,7 +421,8 @@ jsonlint.parse = function(input) {
try {
dougJSONParse(input);
} catch(e) {
if(/Duplicate key|Bad string/.test(e.message)) {
console.error(e);
if(/Duplicate key|Bad string|Unexpected/.test(e.message)) {
var lineNumber = input.substring(0, e.at).split('\n').length;
throw SyntaxError(e.message + ' on line ' + lineNumber);
}