changeset 2480:b0185066e802

Handle exceptions in get_language_by_jid
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 20 Jul 2007 23:08:12 +0200
parents 76f87ae87759
children 4030f9321319
files jabberbot/xmlrpcbot.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jabberbot/xmlrpcbot.py	Fri Jul 20 17:44:02 2007 +0200
+++ b/jabberbot/xmlrpcbot.py	Fri Jul 20 23:08:12 2007 +0200
@@ -228,7 +228,14 @@
         """Returns language of the a user identified by the given JID"""
 
         server = xmlrpclib.ServerProxy(self.config.wiki_url + "?action=xmlrpc2")
-        language = server.getUserLanguageByJID(command.jid)
+        try:
+            language = server.getUserLanguageByJID(command.jid)
+        except xmlrpclib.Fault, fault:
+            self.log.error(str(fault))
+        except xmlrpclib.Error, err:
+            self.log.error(str(err))
+        except Exception, exc:
+            self.log.critical(str(exc))
 
         command.language = language or "en"
         self.commands_out.put_nowait(command)