[Twisted-web] XML-RPC: Failure vs. Fault

Simon Hedberg simon at hedberg.net
Fri Feb 17 06:16:36 MST 2006


Diwaker Gupta wrote:
> I'm trying to build up some XML-RPC based services. I was reading
> through the documentation [1] where its mentioned that xmlrpc_foo()
> functions in the server can return Failure objects to indicate
> errors.   
> 
> The XML-RPC spec uses a slightly different terminology of Faults. The
> xmlrpclib in Python's standard library also talks about being able to
> return Fault objects in case of errors.  
> 
> I was wondering how this is dealt with in Twisted. Fault objects have
> explicit faultCode and faultString parameters. I couldn't determine
> if and how these map to attributes of a Failure object.  
> 
> [1]
> http://twistedmatrix.com/projects/web/documentation/howto/xmlrpc.html 
> 
> TIA,
> Diwaker

I remember doing a hack regarding this in the past. Now that I take a
closer look at it though, it seems that you only have to raise a
xmlrpclib.Fault(faultCode,faultString) in your errback for it to behave
properly. 

/Simon




More information about the Twisted-web mailing list