fix logging error messages

This commit is contained in:
smart_ex 2022-04-20 15:41:59 +10:00 committed by Danil Kovtonyuk
parent 632dce129d
commit 9488090892
4 changed files with 4 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -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 => {

View File

@ -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)
}
}