Skip to content

Commit 3dd46e4

Browse files
authored
Merge pull request #66 from mgilfillan/master
Include curl error in exception message
2 parents 331badc + 7872990 commit 3dd46e4

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Requests/HttpRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public function executeCurl();
2929
*/
3030
public function getInfo($name);
3131

32+
/**
33+
* @return string
34+
*/
35+
public function getError();
36+
3237
/**
3338
* @return mixed
3439
*/

src/Requests/MailchimpConnection.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function execute()
186186
{
187187
$this->response = $this->executeCurl();
188188
if (!$this->response) {
189-
throw new MailchimpException("The curl request failed");
189+
throw new MailchimpException("The curl request failed: " . $this->getError());
190190
}
191191

192192
$this->http_code = $this->getInfo(CURLINFO_HTTP_CODE);
@@ -267,6 +267,14 @@ public function getInfo($name)
267267
return curl_getinfo($this->handle, $name);
268268
}
269269

270+
/**
271+
* @return string
272+
*/
273+
public function getError()
274+
{
275+
return curl_error($this->handle);
276+
}
277+
270278
/**
271279
* @inheritdoc
272280
*/

0 commit comments

Comments
 (0)