J Kenneth King schrieb:
I recently started a project called TracShell
(http://code.google.com/p/tracshell) where I make heavy use of the
xmlrpclib core module.
When the number of RPC calls was small, wrapping each call in try/except
was acceptable. However, this obviously will duplicate code all over the
place. There are only ever two exceptions that the module itself will
throw: xmlrpclib.ProtocolError and xmlrpclib.Fault -- both very useful,
but not show stoppers.
I think the answer depends a lot on the actual error handling performed.
If you want retries, either immediately, or with some larger prologue,
it might make sense to abstract that away (I would have suggested the
context-manager thing myself, but Cameron did that already).
But if you essentially want to abort in all cases, I'd just push the
handling upwards, and rather improve the error reporting itself, e.g. by
storing away the trace in a temporary file the user can send you.
Diez
--
http://mail.python.org/mailman/listinfo/python-list