Handle weird response body when fetching Bisq price.

fixes #145
This commit is contained in:
softsimon 2020-10-26 19:33:20 +07:00
parent 9a94fccf40
commit 1fc4e9530d
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7

View File

@ -139,7 +139,7 @@ class Bisq {
private updatePrice() {
request('https://markets.bisq.network/api/trades/?market=bsq_btc', { json: true }, (err, res, trades: BisqTrade[]) => {
if (err) { return logger.err('Error updating Bisq market price: ' + err); }
if (err || !Array.isArray(trades)) { return logger.err('Error updating Bisq market price: ' + err); }
const prices: number[] = [];
trades.forEach((trade) => {