mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-09 05:23:26 +00:00
fix(@embark/parity): fix version result not available
This commit is contained in:
parent
9803507221
commit
a4b3ef454a
@ -4,7 +4,15 @@ const http = require("http");
|
|||||||
const LIVENESS_CHECK=`{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":42}`;
|
const LIVENESS_CHECK=`{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":42}`;
|
||||||
|
|
||||||
const parseAndRespond = (data, cb) => {
|
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('/');
|
const [_, version, __] = resp.result.split('/');
|
||||||
cb(null, version);
|
cb(null, version);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user