From 094ff0d03d45d24932dc30af50bb351ea5396b5b Mon Sep 17 00:00:00 2001 From: Andrey Gubanov Date: Mon, 5 Jun 2017 19:55:27 +0300 Subject: [PATCH] Throw error when Doug parser throws 'Unexpected' --- lib/jsonlint.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jsonlint.js b/lib/jsonlint.js index 71e9736..8c4899e 100644 --- a/lib/jsonlint.js +++ b/lib/jsonlint.js @@ -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); }