Hi,
this PR adds storing of Jira response into JiraException in case of failed request. You can than easily read it in catch block and display errors to user.
Currently it is possible to retrieve response only from exception message using regexp which is more like a workaround.
Example of usage:
try {
// some operation which throws JiraException
} catch (\JiraRestApi\JiraException $e) {
$response = $e->getResponse();
if ($response) {
// request finished with status code >= 400
$response = json_decode($response);
$jiraErrorMessages = $response->errorMessages;
$jiraErrors = $response->errors;
} else {
// request failed without response (possibly network error)
}
}
Hi, this PR adds storing of Jira response into JiraException in case of failed request. You can than easily read it in catch block and display errors to user.
Currently it is possible to retrieve response only from exception message using regexp which is more like a workaround.
Example of usage: