[Twisted-Python] Pass error (exception) message to XMLRPC client

Brett Viren bv at bnl.gov
Wed Apr 27 08:34:48 MDT 2005


Remy C Cool <remy.cool at smartology.nl> writes:

> Hello,
>
> I've searched on the (Twisted) website and mailinglists, but failed to
> find the answer to my question.
>
> Is is possible to pass the original exception code/message to the
> XMLRPC client? When an exception occurs, the client get's a general
> 'error occured' message and I would like to be able to let the client
> know what went wrong. How can I accomplish this with Twisted?

It isn't really an exception but I use the idiom of returning an
(int,string) tuple:

  (err,error_message)

If err != 0, it's interpreted as an error code.  A successful return
is (0,"").

I don't happen to do it, but I suppose you could then raise an
exception on the client size by hand when non-zero is returned.

-Brett.




More information about the Twisted-Python mailing list