From 12ed393f6cf0fb4588733f92cac5a8f723c54ee2 Mon Sep 17 00:00:00 2001 From: Dave Pedu Date: Mon, 25 Apr 2016 07:49:52 -0700 Subject: [PATCH] Prevent crash when bot calls _connect and fails due to dns lookup failure --- pyircbot/pyircbot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyircbot/pyircbot.py b/pyircbot/pyircbot.py index 7bc27a5..1667158 100644 --- a/pyircbot/pyircbot.py +++ b/pyircbot/pyircbot.py @@ -9,6 +9,7 @@ import logging import time import sys +import traceback from pyircbot.rpc import BotRPC from pyircbot.irccore import IRCCore import os.path @@ -63,7 +64,11 @@ class PyIRCBot: self.connect() def connect(self): - self.irc._connect() + try: + self.irc._connect() + except: + self.log.error("Pyircbot attempted to connect and failed!") + self.log.error(traceback.format_exc()) def loop(self): self.irc.loop()