2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-31 14:15:25 +00:00

console.error unhandled errors

This commit is contained in:
GingerPlusPlus
2017-09-24 18:34:32 +02:00
parent 3ffdee8c89
commit 3e344ceca2
2 changed files with 6 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ require('dotenv').config();
// Utils
const { deleteAfter } = require('./utils/tg');
const { logErrorProperly } = require('./utils/log');
// Bot
const bot = require('./bot');
@@ -48,4 +49,6 @@ bot.command('report', reportHandler);
bot.hears(/^@admins?$/i, reportHandler);
bot.command('staff', staffHandler);
bot.catch(logErrorProperly);
bot.startPolling();

View File

@@ -5,10 +5,13 @@ const { inspect } = require('util');
const logError = log => err =>
log && console.error(`${err.name}: ${err.message}`);
const logErrorProperly = err => console.error(err);
const print = value =>
console.log(inspect(value, { colors: true, depth: null }));
module.exports = {
logError,
logErrorProperly,
print
};