Include additional error code information in error message when possible

This commit is contained in:
Zach Borboa
2016-08-31 23:31:59 -07:00
parent 6e636f02c8
commit d70c770cc1
+6
View File
@@ -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;