Skip to content

Commit fee5bf0

Browse files
author
AffanTheBest
committed
Add bot.catch (Error handler)
1 parent 92ae379 commit fee5bf0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bot.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ const track = async () => {
146146
} catch (e) { }
147147
}
148148

149+
bot.catch((err) => {
150+
console.error('err');
151+
const ctx = err.ctx;
152+
console.error(`Error while handling update ${ctx.update.update_id}:`);
153+
const e = err.error;
154+
console.error("Error: ", e.description);
155+
});
156+
149157
setInterval(track, 3600000); //Track every hr.
150158

151159
module.exports = bot;

0 commit comments

Comments
 (0)