Skip to content

Commit

Permalink
Different Bittrex error (DeviaVir#659)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
KryptoNova authored Nov 15, 2017
1 parent b53abcc commit e472412
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extensions/exchanges/bittrex/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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)
})
Expand Down

0 comments on commit e472412

Please sign in to comment.