[Zope] xmlrpc fault error messages
Tim Hicks
tim@sitefusion.co.uk
Mon, 8 Jul 2002 15:12:44 +0100
Does anyone have a nice looking way of dealing with these? The problem for
me is that I just get the zope attribution button in my browser and have to
scour the html source to find the real problem. The xmlrpclib.Fault string
seems to be dumped in its entirety into the standard_error_message,
resulting in malformed html.
I tried this
<begin python>
error_type_re = re.compile('<strong>Error Type.+?</strong>', re.IGNORECASE |
re.DOTALL)
error_value_re = re.compile('<strong>Error Value.+?</strong>', re.IGNORECASE
| re.DOTALL)
class zlaveXmlrpcError(Exception):
def __init__(self, xmlrpc_fault):
error_type = error_type_re.search(str(xmlrpc_fault)).group()
error_value = error_value_re.search(str(xmlrpc_fault)).group()
self.args = (error_type, error_value)
<end python>
but when zope displays my zlaveXmlrpcError, I don't get the 'Site Error' and
other standard_error_message formatting.
tim