A 5xx response indicates that the server failed to fulfill an otherwise valid request because of an unexpected implementation problem or planned unavailability. Codes from 500 through 599 identify the provider as responsible. section 4.5.1
Use 5xx responses to classify provider-side failures:
- Return 500 Internal Server Error for unexpected server errors, such as a null pointer exception or inaccessible database server. section 4.5.1 section 4.9
- Distinguish provider failures from 4xx consumer errors and 2xx successful operations. section 4.5.1 section 4.5.2
- Prefer assigned, commonly used status codes; avoid custom or unassigned codes that create compatibility problems. section 4.5.2
Figure 4.12 An HTTP status has a numeric code and human-readable reason. The class system allows for easily identifying whether the code signifies a success or an error and who is at fault.
The status-class diagram connects a numeric code and human-readable reason with success or error responsibility. section 4.5.1
