How to Catch Errors in SimpleXMLRPCServer
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Thu Sep 27 15:48:22 EDT 2007
gregpinero at gmail.com a écrit :
> I have a pretty simple XMLRPCServer, something along the lines of the
> example:
>
> server = SimpleXMLRPCServer(("localhost", 8000))
> server.register_function(pow)
> server.register_function(lambda x,y: x+y, 'add')
> server.serve_forever()
>
> Now what I want to do is catch any errors that happen on requests, and
> ideally have them emailed to me. I have the email part all taken care
> of, I just need to know how to get at the exceptions.
Q&D :
try:
server.serve_forever()
except Exception, e:
mail_me_the_exception(e)
raise
More information about the Python-list
mailing list