From 213451f0d6d5ed017f29a319afa1f98cb2116a59 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 14 Apr 2015 15:18:33 -0300 Subject: [PATCH] handle error from blockexplores --- lib/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index c3e8593..0a789cd 100644 --- a/lib/server.js +++ b/lib/server.js @@ -458,7 +458,7 @@ WalletService.prototype._getUtxos = function(cb) { var bc = self._getBlockchainExplorer('insight', networkName); bc.getUnspentUtxos(addressStrs, function(err, inutxos) { - if (err) return cb(err); + if (err) return cb(new Error('Could not fetch unspend outputs:' + err)); var utxos = _.map(inutxos, function(i) { return _.pick(i.toObject(), ['txid', 'vout', 'address', 'scriptPubKey', 'amount', 'satoshis']); }); @@ -1121,7 +1121,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) { }, function(next) { bc.getTransactions(addressStrs, null, null, function(err, txs) { - if (err) return next(err); + if (err) return next('Could not fetch transactions: ' + err); next(null, self._normalizeTxHistory(txs)); }); @@ -1179,7 +1179,7 @@ WalletService.prototype.scan = function(opts, cb) { if (err) return next(err); allAddresses.push(addresses); checkActivity(_.pluck(addresses, 'address'), function(err, thereIsActivity) { - if (err) return next(err); + if (err) return next('Could not fetch TX activity:' + err); activity = thereIsActivity; next(); });