From ef2b4ea5706877cc83ea61f2ca9d2ee823b394c1 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 25 Oct 2018 15:20:29 -0400 Subject: [PATCH] fix error message that print undefined --- lib/core/logger.js | 7 +++---- lib/modules/blockchain_connector/index.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/core/logger.js b/lib/core/logger.js index 50030ff5..b02781f3 100644 --- a/lib/core/logger.js +++ b/lib/core/logger.js @@ -1,7 +1,6 @@ require('colors'); let fs = require('./fs.js'); const date = require('date-and-time'); -const constants = require('../constants'); const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss:SSS'; const LOG_REGEX = new RegExp(/\[(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d:\d\d\d)\] (?:\[(\w*)\]:?)?\s?\s?(.*)/gmi); @@ -91,7 +90,7 @@ Logger.prototype.error = function () { return; } this.events.emit("log", "error", ...arguments); - this.logFunction(...Array.from(arguments).map(t => {return t ? t.red : t;})); + this.logFunction(...Array.from(arguments).map(t => { return t ? t.red : t; })); this.writeToFile("[error]: ", ...arguments); }; @@ -100,7 +99,7 @@ Logger.prototype.warn = function () { return; } this.events.emit("log", "warn", ...arguments); - this.logFunction(...Array.from(arguments).map(t => {return t ? t.yellow : t;})); + this.logFunction(...Array.from(arguments).map(t => { return t ? t.yellow : t; })); this.writeToFile("[warning]: ", ...arguments); }; @@ -109,7 +108,7 @@ Logger.prototype.info = function () { return; } this.events.emit("log", "info", ...arguments); - this.logFunction(...Array.from(arguments).map(t => {return t ? t.green : t;})); + this.logFunction(...Array.from(arguments).map(t => { return t ? t.green : t; })); this.writeToFile("[info]: ", ...arguments); }; diff --git a/lib/modules/blockchain_connector/index.js b/lib/modules/blockchain_connector/index.js index 5f83b45a..a12da9c5 100644 --- a/lib/modules/blockchain_connector/index.js +++ b/lib/modules/blockchain_connector/index.js @@ -538,8 +538,8 @@ class BlockchainConnector { function(next) { async.times(limit, function(n, eachCb) { self.web3.eth.getBlock(from - n, returnTransactionObjects, function(err, block) { - if (err) { - self.logger.error(err); + if (err && err.message) { + // FIXME Returns an error because we are too low return eachCb(); } blocks.push(block);