stanzabase: Pass problematic object to TypeError raised by ElementBase.append()

This should help debugging those type of errors.
This commit is contained in:
nicoco 2024-09-28 10:28:20 +02:00
parent b94c6716f7
commit 3b2386ee2f

View File

@ -1230,7 +1230,7 @@ class ElementBase(object):
if type(item) == XML_TYPE: if type(item) == XML_TYPE:
return self.appendxml(item) return self.appendxml(item)
else: else:
raise TypeError raise TypeError(f"Cannot append {item!r} to a stanza")
self.xml.append(item.xml) self.xml.append(item.xml)
if item.__class__ == self.plugin_tag_map.get(item.tag_name(), None): if item.__class__ == self.plugin_tag_map.get(item.tag_name(), None):
self.init_plugin(item.plugin_attrib, self.init_plugin(item.plugin_attrib,