Faults

When an error occurs, the system returns an HTTP error response code denoting the type of error. The system also returns additional information about the fault in the body of the response.

 

Example 1.29. XML Fault Response

<?xml version="1.0" encoding="UTF-8"?>
<identityFault xmlns="http://docs.openstack.org/identity/api/v2.0"
          code="500">
    <message>Fault</message>
    <details>Error Details...</details>
</identityFault>

 

Example 1.30. JSON Fault Response

{
  "identityFault": {
    "message": "Fault",
    "details": "Error Details...",
    "code": 500
  }
}

The error code is returned in the body of the response for convenience. The message section returns a human readable message. The details section is optional and may contain useful information for tracking down an error (such as, a stack trace).

The root element of the fault (for example, identityFault) may change depending on the type of error. The following is an example of an itemNotFound error.

 

Example 1.31. XML Not Found Fault

<?xml version="1.0" encoding="UTF-8"?>
<itemNotFound xmlns="http://docs.openstack.org/identity/api/v2.0"
              code="404">
    <message>Item not found.</message>
    <details>Error Details...</details>
</itemNotFound>

 

Example 1.32. JSON Not Found Fault

{
  "itemNotFound": {
    "message": "Item not found.",
    "details": "Error Details...",
    "code": 404
  }
}

The following list shows the possible fault types with associated error codes.

Table 1.4. Fault Types
Fault Element Associated Error Code Expected in All Requests
identityFault 500, 400
serviceUnavailable 503
badRequest 400
unauthorized 401
overLimit 413
userDisabled 403
forbidden 403
itemNotFound 404
tenantConflict 409

From an XML schema perspective, all API faults are extensions of the base fault type identityFault. When working with a system that binds XML to actual classes (such as JAXB), one should be capable of using identityFault as a “catch-all” if there's no interest in distinguishing between individual fault types.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...