When an error occurs, the system will return an HTTP error response code denoting the type of error. The system will also return additional information about the fault in the body of the response.
Example 3.20. Fault Response: XML
<?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 3.21. Fault Response: JSON
{
"identityFault": {
"message": "Fault",
"details": "Error Details...",
"code": 500
}
}
The error code is returned in the body of the response. The message section returns a human-readable message. The details section is optional and may contain useful information for tracking down an error. For example, a stack trace may be provided.
The root element of the fault may change depending on the type of error. The following is an example of an itemNotFound error.
Example 3.22. Item Not Found Fault: XML
<?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 3.23. Item Not Found Fault: JSON
{
"itemNotFound": {
"message": "Item not found.",
"details": "Error Details...",
"code": 404
}
}
The following is a list of possible fault types along with their associated error codes.
| Fault Element | Associated Error Codes | Expected in All Requests |
| identityFault | 500, 400 | YES |
| serviceUnavailable | 503 | YES |
| badRequest | 400 | YES |
| unauthorized | 401 | YES |
| 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, use identityFault as a catch-all if there is no interest in distinguishing between individual fault types; for example, you may need to do this if you are working with JAXB.

