diff --git a/include/lib_jira.php b/include/lib_jira.php index 2c97eb6..fd7e819 100644 --- a/include/lib_jira.php +++ b/include/lib_jira.php @@ -40,8 +40,10 @@ function jira_new_issue_create($data){ $response = curl_exec($ch); $ch_error = curl_error($ch); + $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); - if ($ch_error){ + if ($ch_error || $httpcode >= 400){ // echo "cURL Error: $ch_error"; return array( "ok" => false, @@ -81,7 +83,9 @@ function jira_new_issue_get($epic){ $response = curl_exec($ch); $ch_error = curl_error($ch); - if ($ch_error){ + $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + if ($ch_error || $httpcode >= 400){ // echo "cURL Error: $ch_error"; curl_close($ch); return array( @@ -134,8 +138,9 @@ function jira_new_issue_add_checklistitem($issue_id, $customfield_id, $checklist $response = curl_exec($ch); $ch_error = curl_error($ch); + $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($ch_error){ + if ($ch_error || $httpcode >= 400){ // echo "cURL Error: $ch_error"; curl_close($ch); return array(