Skip to content

Commit

Permalink
add error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
XenosOrdo committed Sep 19, 2021
1 parent a97abff commit c23821e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bot.use(blockDetection, auth)

bot.use(stage)

bot.catch(console.error)
bot.catch((err) => log.error(`Handle update error: ${err}`))

bot.on(
'callback_query',
Expand Down
2 changes: 1 addition & 1 deletion i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ const path = require('path')
module.exports = new TelegrafI18n({
defaultLanguage: 'en',
directory: path.resolve(__dirname, 'locales'),
})
})
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const mongoose = require('mongoose')
const transactionQueue = require('./queues/transaction')
const config = require('./config')
const log = require('./utils/log')
const startBot = require('./bot')
const transactionProcessor = require('./queues/transactionProcessor')

transactionQueue.on('failed', (job, err) => console.error(err))
transactionQueue.on('failed', (job, err) => log.error(`Transaction processing error: ${err}`))

mongoose
.connect(config.get('db'))
.then(() => startBot())
.then(() => transactionQueue.process(transactionProcessor))
.catch(console.error)
.catch((err) => log.error(`Bot initialization error: ${err}`))
4 changes: 2 additions & 2 deletions monitors/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ mongoose
() =>
scanAddresses().catch((err) => {
IS_RUNNING = false
console.error(err)
log.error(`Scan adresses error: ${err}`)
}),
config.get('synchronizer.interval'),
),
)
.catch(console.error)
.catch((err) => log.error(`Monitor initialization error: ${err}`))

0 comments on commit c23821e

Please sign in to comment.