mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 14:19:17 +00:00
Include additional error code information in error message when possible
This commit is contained in:
@@ -346,6 +346,12 @@ class Curl
|
||||
$this->curlErrorMessage = curl_error($ch);
|
||||
}
|
||||
$this->curlError = !($this->curlErrorCode === 0);
|
||||
|
||||
// Include additional error code information in error message when possible.
|
||||
if ($this->curlError && function_exists('curl_strerror')) {
|
||||
$this->curlErrorMessage = curl_strerror($this->curlErrorCode) . ': ' . $this->curlErrorMessage;
|
||||
}
|
||||
|
||||
$this->httpStatusCode = $this->getInfo(CURLINFO_HTTP_CODE);
|
||||
$this->httpError = in_array(floor($this->httpStatusCode / 100), array(4, 5));
|
||||
$this->error = $this->curlError || $this->httpError;
|
||||
|
||||
Reference in New Issue
Block a user