Permalink
Browse files

Fix error handling

  • Loading branch information...
1 parent 6a0eb92 commit 25700d1a67e3e8be272a29d0417286f6fd68d025 @phpnode committed Feb 23, 2012
Showing with 5 additions and 2 deletions.
  1. +1 −1 ACurl.php
  2. +4 −1 ACurlResponse.php
View
@@ -219,7 +219,7 @@ protected function exec() {
$response->data = false;
}
}
- if ($response->getIsError()) {
+ if ($response->getIsError() && $response->getLastHeaders() !== false) {
throw new ACurlException($response->getLastHeaders()->http_code,"Curl Error: ".$response->getLastHeaders()->http_code,$response);
}
if (curl_error($this->getHandle())) {
View
@@ -64,7 +64,10 @@ public function setInfo($value) {
* @return CAttributeCollection the headers
*/
public function getLastHeaders() {
- return $this->getHeaders()->itemAt(0);
+ if ($this->getHeaders()->count() > 0) {
+ return $this->getHeaders()->itemAt(0);
+ }
+ return false;
}
/**

0 comments on commit 25700d1

Please sign in to comment.