Output exception warnings to stderr

This commit is contained in:
Alexei Sorokin 2016-08-11 00:07:23 +03:00
parent 9e5356590e
commit 39da2633f5

View File

@ -58,7 +58,7 @@ class IRCBot:
if nick not in self.inter.get_irc_users():
self.inter.append_irc_user(nick)
except Exception as e:
print(e)
sys.stderr.write(str(e) + '\n')
def on_namreply(self, conn, event):
for nick in event.arguments[2].split():
@ -75,7 +75,7 @@ class IRCBot:
for i in range(0, len(msg), buffer):
self.conn.privmsg(self.opts['chan'], msg[i:i + buffer])
except Exception as e:
print(e)
sys.stderr.write(str(e) + '\n')
def start(self):
self.register_handlers()
@ -125,14 +125,14 @@ class XMPPBot:
if nick not in self.inter.get_xmpp_users():
self.inter.append_xmpp_user(nick)
except Exception as e:
print(e)
sys.stderr.write(str(e) + '\n')
def send_message(self, msg):
try:
self.client.send_message(mto=self.opts['muc'], mbody=msg,
mtype='groupchat')
except Exception as e:
print(e)
sys.stderr.write(str(e) + '\n')
def start(self):
self.client.register_plugin('xep_0045') # XMPP MUC.
@ -235,7 +235,7 @@ class Intermedia:
self.to_irc(nick_prefix + m)
except Exception as e:
print(e)
sys.stderr.write(str(e) + '\n')
def get_irc_users(self):
return self.irc_users