Skip to content

Commit

Permalink
[coinfcalcon] catch errors with unclear mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Apr 19, 2019
1 parent 6522e6f commit 2e767cd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions exchange/wrappers/coinfalcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ const recoverableErrors = [
'EAI_AGAIN'
];

// errors that might mean
// the API call succeeded.
const unknownResultErrors = [
'524',
]

Trader.prototype.processResponse = function(method, args, next) {

const requestAt = moment();
Expand All @@ -77,11 +83,13 @@ Trader.prototype.processResponse = function(method, args, next) {
}

const catcher = err => {
if(!err || !err.message)
if(!err || !err.message) {
err = new Error(err || 'Empty error');
}

if(includes(err.message, recoverableErrors))
if(includes(err.message, recoverableErrors)) {
return this.retry(method, args);
}

console.log(new Date, '[cf] big error!', err.message, method);

Expand Down

0 comments on commit 2e767cd

Please sign in to comment.