From e472412e50180339c14000a47567bb2007ddcf3c Mon Sep 17 00:00:00 2001 From: KryptoNova Date: Wed, 15 Nov 2017 18:30:32 -0500 Subject: [PATCH] Different Bittrex error (#659) This fix should handle any error that happens and then fire's off a retry. I tried the Try .. Catch block on fiddle and it worked flawlessly to capture the error in question. I'm not sure how to exactly test the retry, but I created the statement similar to the one on line 78. This technically should be recoverable, because Bittrex is just having some sort of hiccup on their API sending data. --- extensions/exchanges/bittrex/exchange.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/exchanges/bittrex/exchange.js b/extensions/exchanges/bittrex/exchange.js index eb859778d5..96590753c1 100644 --- a/extensions/exchanges/bittrex/exchange.js +++ b/extensions/exchanges/bittrex/exchange.js @@ -82,7 +82,7 @@ module.exports = function container(get, set, clear) { } var trades = [] - if (typeof data.result !== 'undefined') { + try { Object.keys(data.result).forEach(function (i) { var trade = data.result[i] trades.push({ @@ -93,6 +93,9 @@ module.exports = function container(get, set, clear) { side: trade.OrderType == 'BUY' ? 'buy' : 'sell' }) }) + } catch (e) { + console.log('bittrex API (getmarkethistory). Retry in progress. Error:' + e); + return retry('getTrades', func_args, e.toString()); } cb(null, trades) })