summaryrefslogtreecommitdiffstats
path: root/src/PurpleCode/PCurl/PCurl.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/PurpleCode/PCurl/PCurl.php')
-rw-r--r--src/PurpleCode/PCurl/PCurl.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/PurpleCode/PCurl/PCurl.php b/src/PurpleCode/PCurl/PCurl.php
index cd442d0..090f8a7 100644
--- a/src/PurpleCode/PCurl/PCurl.php
+++ b/src/PurpleCode/PCurl/PCurl.php
@@ -26,7 +26,7 @@ class PCurl {
public function __construct($host) {
if (!function_exists('curl_init')) {
- throw new PCurlException('CURL module not available! See http://php.net/manual/en/book.curl.php');
+ throw new PCurlException('CURL module not available! See http://php.net/manual/en/book.curl.php', 500, 2 /*CURLE_FAILED_INIT */);
}
$this->host = $host;
@@ -100,8 +100,9 @@ class PCurl {
$response = curl_exec($curl);
if (!$response) {
$error = curl_error($curl);
+ $errorCode = curl_errno($curl);
curl_close($curl);
- throw new PCurlException($error);
+ throw new PCurlException($error, 400, $errorCode);
}
$headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);