diff --git a/routes/component_testing.js b/routes/component_testing.js index 26b77c7..f8584a4 100644 --- a/routes/component_testing.js +++ b/routes/component_testing.js @@ -113,7 +113,14 @@ function performTest(params) { // Handle normal output scriptExecution.stdout.on('data', (data) => { console.log(uint8arrayToString(data)); - let jsonObj = JSON.parse(uint8arrayToString(data)); + let jsonObj = null; + try { + jsonObj = JSON.parse(uint8arrayToString(data)); + } + catch (e) { + console.log(e); + return; + } console.log(jsonObj); // Store the update as the current status diff --git a/routes/scan.js b/routes/scan.js index b568ff3..fe69fc8 100644 --- a/routes/scan.js +++ b/routes/scan.js @@ -85,7 +85,14 @@ function performScan(params) { // Handle normal output scriptExecution.stdout.on('data', (data) => { - let jsonObj = JSON.parse(uint8arrayToString(data)); + let jsonObj = null; + try { + jsonObj = JSON.parse(uint8arrayToString(data)); + } + catch (e) { + console.log(e); + return; + } console.log(jsonObj); // Store the update as the current status