diff --git a/src/priceWatcher.js b/src/priceWatcher.js index 56d68f7..8d61882 100644 --- a/src/priceWatcher.js +++ b/src/priceWatcher.js @@ -39,7 +39,7 @@ async function main() { await redis.hmset('prices', ethPrices) console.log('Wrote following prices to redis', ethPrices) } catch (e) { - await logRelayerError(redis, e.message) + await logRelayerError(redis, e) console.error('priceWatcher error', e) } } diff --git a/src/treeWatcher.js b/src/treeWatcher.js index 92add34..b0ddf96 100644 --- a/src/treeWatcher.js +++ b/src/treeWatcher.js @@ -123,7 +123,7 @@ async function init() { eventSubscription = contract.events.NewAccount({ fromBlock: toBlock + 1 }, processNewEvent) blockSubscription = web3.eth.subscribe('newBlockHeaders', processNewBlock) } catch (e) { - await logRelayerError(redis, e.message) + await logRelayerError(redis, e) console.error('error on init treeWatcher', e.message) } } diff --git a/src/utils.js b/src/utils.js index 525b3c9..1078c10 100644 --- a/src/utils.js +++ b/src/utils.js @@ -136,7 +136,7 @@ class RelayerError extends Error { } const logRelayerError = async (redis, e) => { - await redis.zadd('errors', 'INCR', 1, e.message) + await redis.zadd('errors', 'INCR', e.score || 1, e.message) } const readRelayerErrors = async redis => { diff --git a/src/worker.js b/src/worker.js index 2109c96..937ee6f 100644 --- a/src/worker.js +++ b/src/worker.js @@ -106,7 +106,7 @@ async function start() { queue.process(processJob) console.log('Worker started') } catch (e) { - await logRelayerError(redis, e.message) + await logRelayerError(redis, e) console.error('error on start worker', e.message) } }