-
Notifications
You must be signed in to change notification settings - Fork 9
In certain cases pyxmpp eats exceptions #14
Description
xmlextra.endElement() eats exceptions, instead of letting them propagate.
While it's bad style to let exceptions get away from callbacks, it may happen and then errors don't get reported. In my case an unexpected UnicodeEncodeError from pyxmpp code itself wasn't caught in my code, wreaked some havoc and vanished without a trace. Not a pleasant thing to debug.
Relevant part of a stack from my case to illustrate the issue:
{{{
File "/home/karol/programowanie/pyxmpp/pyxmpp/xmlextra.py", line 214, in endElement
self._handler.stanza(self._doc, node1)
File "/home/karol/programowanie/pyxmpp/pyxmpp/streambase.py", line 401, in stanza
self._process_node(node)
File "/home/karol/programowanie/pyxmpp/pyxmpp/stream.py", line 107, in _process_node
StreamBase._process_node(self,xmlnode)
File "/home/karol/programowanie/pyxmpp/pyxmpp/streambase.py", line 710, in _process_node
self.process_stanza(stanza)
File "/home/karol/programowanie/pyxmpp/pyxmpp/stanzaprocessor.py", line 274, in process_stanza
if self.process_message(stanza):
File "/home/karol/programowanie/pyxmpp/pyxmpp/stanzaprocessor.py", line 209, in process_message
return self.__try_handlers(self._message_handlers,"normal",stanza)
File "/home/karol/programowanie/pyxmpp/pyxmpp/stanzaprocessor.py", line 185, in __try_handlers
response = handler(stanza)
File "/home/karol/programowanie/soc/tmp/jabberbot/xmppbot.py", line 372, in handle_message
response = self.handle_internal_command(sender, command)
File "/home/karol/programowanie/soc/tmp/jabberbot/xmppbot.py", line 402, in handle_internal_command
self.send_search_form(sender)
File "/home/karol/programowanie/soc/tmp/jabberbot/xmppbot.py", line 319, in send_search_form
message.add_content(form)
File "/home/karol/programowanie/pyxmpp/pyxmpp/stanza.py", line 303, in add_content
content.as_xml(parent = self.xmlnode, doc = common_doc)
File "/home/karol/programowanie/pyxmpp/pyxmpp/objects.py", line 91, in as_xml
self.complete_xml_element(xmlnode, doc1)
File "/home/karol/programowanie/pyxmpp/pyxmpp/jabber/dataforms.py", line 632, in complete_xml_element
xmlnode.newTextChild(ns, "title", self.title)
File "/usr/lib64/python2.3/site-packages/libxml2.py", line 3325, in newTextChild
ret = libxml2mod.xmlNewTextChild(self._o, ns__o, name, content)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u015b' in position 2: ordinal not in range(128)
}}}