Previous topic


Next topic

Persisting Objects

This Page


class spyne.model.fault.Fault(faultcode='Server', faultstring='', faultactor='', detail=None)[source]

Bases: spyne.model.complex.ComplexModelBase, exceptions.Exception

Use this class as a base for all public exceptions. The Fault object adheres to the SOAP 1.1 Fault definition,

which has three main attributes:

  • faultcode

    It’s a dot-delimited string whose first fragment is either ‘Client’ or ‘Server’. Just like HTTP 4xx and 5xx codes, ‘Client’ indicates that something was wrong with the input, and ‘Server’ indicates something went wrong during the processing of an otherwise legitimate request.

    Protocol implementors should heed the values in faultcode to set proper return codes in the protocol level when necessary. E.g. HttpRpc protocol will return a HTTP 404 error when a spyne.error.ResourceNotFound is raised, and a general HTTP 400 when the faultcode starts with 'Client.' or is 'Client'.

    Soap would return Http 500 for any kind of exception, and denote the nature of the exception in the Soap response body. (because that’s what the standard says... Yes, soap is famous for a reason :))

  • faultstring – It’s the human-readable explanation of the exception.
  • detail – Additional information dict.