From a4b3ef454a7ac08df52a3a3607d1bcf82278b4ba Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 28 Oct 2019 12:37:33 -0400 Subject: [PATCH] fix(@embark/parity): fix version result not available --- packages/plugins/parity/src/check.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/plugins/parity/src/check.js b/packages/plugins/parity/src/check.js index d061b8ffe..fe9874462 100644 --- a/packages/plugins/parity/src/check.js +++ b/packages/plugins/parity/src/check.js @@ -4,7 +4,15 @@ const http = require("http"); const LIVENESS_CHECK=`{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":42}`; const parseAndRespond = (data, cb) => { - const resp = JSON.parse(data); + let resp; + try { + resp = JSON.parse(data); + } catch (e) { + return cb('Version data is not valid JSON'); + } + if (!resp || !resp.result) { + return cb('No version returned'); + } const [_, version, __] = resp.result.split('/'); cb(null, version); };