fix(bootstrap): fix preventing bootstrap saving #74 #69

This commit is contained in:
Alexey Kasyanchuk 2019-01-28 22:32:13 +03:00
parent ad3fa2dc4d
commit 6e79ae4db3

View File

@ -271,7 +271,12 @@ module.exports = function (send, recive, dataDirectory, version, env)
});
resp.on('end', () => {
resolve(data.length > 0 && JSON.parse(data))
try {
resolve(data.length > 0 && JSON.parse(data))
} catch(e) {
logTE('p2p', 'loading bootstrap failed', e)
resolve(false)
}
});
}).on("error", (err) => {
logTE('http', `${url} error: ` + err.message)