The current implementation of ClientInterface has several issues:
- not all error HTTP codes are converted to an exception (e.g. HTTP 401 code is, but others are not)
- the API response is lost when exception is thrown
- cURL transport errors (for
CurlClient only) aren't handled at all
Proposing to:
- throw an exception on any non-2xx HTTP response code
- for the
\chobie\Jira\Api\Exception class:
- add the protected
rawResponse property, which will be populated from the constructor
- add public
getRawReponse method, that will return the above property
- add public
getResponse method, that will return a json-decoded version of the raw response
This way a developer will be informed about the error (through an exception being thrown) and can do further error analysis using the getResponse method.
Also TODO:
Remove code, that is handling errors from the \chobie\Jira\Api::findVersionByName method.