fix: fix error logs in the cockpit due from negative blocks numbers (#1967)

This commit is contained in:
Jonathan Rainville 2019-10-13 21:53:14 -04:00 committed by Iuri Matias
parent d86c26d71a
commit 4b947bb5c2
2 changed files with 7 additions and 4 deletions

View File

@ -153,11 +153,13 @@ export default class EthereumAPI {
});
},
function (next) {
async.times(limit, function (n, eachCb) {
self.web3.eth.getBlock(from - n, returnTransactionObjects, function (err, block) {
if (from - limit < 0) {
limit = from + 1;
}
async.times(limit, (n, eachCb) => {
self.web3.eth.getBlock(from - n, returnTransactionObjects, (err, block) => {
if (err) {
// FIXME Returns an error because we are too low
return eachCb();
return eachCb(err);
}
if (!block) {
return eachCb();

View File

@ -57,6 +57,7 @@ export class Proxy {
// Send the possibly modified request to the Node
requestManager.send(resp.reqData, (err, result) => {
if (err) {
this.logger.debug(JSON.stringify(resp.reqData));
return this.logger.error(__('Error executing the request on the Node'), err.message || err);
}
this.emitActionsForResponse(resp.reqData, {jsonrpc: "2.0", id: resp.reqData.id, result}, (_err, resp) => {