2.34.
ERROR HANDLING
CHAPTER 2.
API REFERENCE
2.34
Error Handling
When a low-level transport error occurs, or a request is malformed at the HTTP or XML-RPC
level, the server may send an XML-RPC Fault response, or the client may simulate the same. The
client must be prepared to handle these errors, though they may be treated as fatal. On the wire,
these are transmitted in a form similar to this:
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value><int>-1</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Malformed request</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
All other failures are reported with a more structured error response, to allow better automatic
response to failures, proper internationalisation of any error message, and easier debugging. On
the wire, these are transmitted like this:
<struct>
<member>
<name>Status</name>
<value>Failure</value>
</member>
<member>
<name>ErrorDescription</name>
<value>
<array>
<data>
<value>MAP_DUPLICATE_KEY</value>
<value>Customer</value>
<value>eSpeil Inc.</value>
<value>eSpeil Incorporated</value>
</data>
</array>
</value>
</member>
</struct>
Note that
ErrorDescription
value is an array of string values. The first element of the array
is an error code; the remainder of the array are strings representing error parameters relating
to that code. In this case, the client has attempted to add the mapping
Customer
→
eSpiel
Incorporated
to a Map, but it already contains the mapping
Customer
→
eSpiel Inc.
, and so
the request has failed.
Each possible error code is documented in the following section.
285