fix logging error messages
This commit is contained in:
parent
632dce129d
commit
9488090892
@ -39,7 +39,7 @@ async function main() {
|
|||||||
await redis.hmset('prices', ethPrices)
|
await redis.hmset('prices', ethPrices)
|
||||||
console.log('Wrote following prices to redis', ethPrices)
|
console.log('Wrote following prices to redis', ethPrices)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await logRelayerError(redis, e.message)
|
await logRelayerError(redis, e)
|
||||||
console.error('priceWatcher error', e)
|
console.error('priceWatcher error', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ async function init() {
|
|||||||
eventSubscription = contract.events.NewAccount({ fromBlock: toBlock + 1 }, processNewEvent)
|
eventSubscription = contract.events.NewAccount({ fromBlock: toBlock + 1 }, processNewEvent)
|
||||||
blockSubscription = web3.eth.subscribe('newBlockHeaders', processNewBlock)
|
blockSubscription = web3.eth.subscribe('newBlockHeaders', processNewBlock)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await logRelayerError(redis, e.message)
|
await logRelayerError(redis, e)
|
||||||
console.error('error on init treeWatcher', e.message)
|
console.error('error on init treeWatcher', e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class RelayerError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const logRelayerError = async (redis, e) => {
|
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 => {
|
const readRelayerErrors = async redis => {
|
||||||
|
@ -106,7 +106,7 @@ async function start() {
|
|||||||
queue.process(processJob)
|
queue.process(processJob)
|
||||||
console.log('Worker started')
|
console.log('Worker started')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await logRelayerError(redis, e.message)
|
await logRelayerError(redis, e)
|
||||||
console.error('error on start worker', e.message)
|
console.error('error on start worker', e.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user