fix error when there are not transaccion
This commit is contained in:
parent
fc1717e7e3
commit
3e8e6358bb
@ -42,6 +42,9 @@ var getTransaction = function(txid, cb) {
|
|||||||
console.log(err);
|
console.log(err);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!tx) return cb(new Error('Transaction not found'));
|
||||||
|
|
||||||
return cb(null, tx.info);
|
return cb(null, tx.info);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -79,13 +82,17 @@ exports.list = function(req, res, next) {
|
|||||||
txs = block.info.tx;
|
txs = block.info.tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txs, getTransaction,
|
async.mapSeries(txs, getTransaction, function(err, results) {
|
||||||
function(err, results) {
|
if (err) {
|
||||||
res.jsonp({
|
console.log(err);
|
||||||
pagesTotal: pagesTotal,
|
res.status(404).send('TX not found');
|
||||||
txs: results
|
}
|
||||||
});
|
|
||||||
|
res.jsonp({
|
||||||
|
pagesTotal: pagesTotal,
|
||||||
|
txs: results
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (addrStr) {
|
else if (addrStr) {
|
||||||
@ -109,13 +116,17 @@ exports.list = function(req, res, next) {
|
|||||||
txs = a.transactions;
|
txs = a.transactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txs, getTransaction,
|
async.mapSeries(txs, getTransaction, function(err, results) {
|
||||||
function(err, results) {
|
if (err) {
|
||||||
res.jsonp({
|
console.log(err);
|
||||||
pagesTotal: pagesTotal,
|
res.status(404).send('TX not found');
|
||||||
txs: results
|
}
|
||||||
});
|
|
||||||
|
res.jsonp({
|
||||||
|
pagesTotal: pagesTotal,
|
||||||
|
txs: results
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -133,6 +144,11 @@ exports.list = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async.mapSeries(txids, getTransaction, function(err, alltxs) {
|
async.mapSeries(txids, getTransaction, function(err, alltxs) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
res.status(404).send('TX not found');
|
||||||
|
}
|
||||||
|
|
||||||
res.jsonp({
|
res.jsonp({
|
||||||
txs: alltxs,
|
txs: alltxs,
|
||||||
length: alltxs.length
|
length: alltxs.length
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user