Quite simply, you'll never get it, understand why.
The reason is, errors with code from 500
to 599
, are usually associated with errors in the server application, which failed to operate a request.
What you should do is first, any error within this range between 500
and 599
, should be treated as API failure and you should treat it even without knowing the reason for the failure. That is, check the httpstatus
before anything, if it is between 500
and 599
, treat it as an API failure and do not expect it to return the reason for the failure.
Keep in mind that if you send a value that the API does not expect and it returns a 500
error for example, it's probably because the type of the value you're sending is unexpected.
Opposing the above situation, if the API handles a data type that is not expected, it is very likely to return a% cos_de error and the reason for the error.
Reference : List of HTTP status codes