From 2ccba495e0c09700cbad0e45d37a8669d379ebca Mon Sep 17 00:00:00 2001 From: Vishrut Shah Date: Tue, 3 Oct 2017 16:49:07 -0700 Subject: [PATCH] Azure PR Bot CI job must fail on the JSON.parse error from linter output --- scripts/momentOfTruth.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/scripts/momentOfTruth.js b/scripts/momentOfTruth.js index 2fecae05cbbf..1830e915eee9 100644 --- a/scripts/momentOfTruth.js +++ b/scripts/momentOfTruth.js @@ -74,18 +74,9 @@ async function getLinterResult(swaggerPath) { let resultString = stderr; if (resultString.indexOf('{') !== -1) { resultString = "[" + resultString.substring(resultString.indexOf('{')).trim().replace(/\}\n\{/g, "},\n{") + "]"; - //console.log('>>>>>> Trimmed Result...'); - //console.log(resultString); - try { - jsonResult = JSON.parse(resultString); - //console.log('>>>>>> Parsed Result...'); - //console.dir(resultObject, {depth: null, colors: true}); - return jsonResult; - } catch (e) { - console.log(`An error occurred while executing JSON.parse() on the linter output for ${swaggerPath}:`); - console.dir(resultString); - console.dir(e, { depth: null, colors: true }); - } + // Do not catch the JSON parse error + jsonResult = JSON.parse(resultString); + return jsonResult; } return []; };