From d70c770cc1b68de13d54efa4ab267fc15be6b438 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Wed, 31 Aug 2016 23:31:59 -0700 Subject: [PATCH] Include additional error code information in error message when possible --- src/Curl/Curl.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 94f3469..38a11ee 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -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;