Permalink
Browse files

CURL error handling

  • Loading branch information...
1 parent 4dce1e8 commit e2c1dce1785a7262b74cf8b8c1fc9d8a4f5edaf2 @thousandsofthem thousandsofthem committed Jun 12, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 IronCore.class.php
View
@@ -11,7 +11,7 @@
*/
class IronCore{
- protected $core_version = '0.0.1';
+ protected $core_version = '0.0.2';
// should be overridden by child class
protected $client_version = null;
@@ -214,6 +214,9 @@ protected function apiCall($type, $url, $params = array(), $raw_post_data = null
protected function callWithRetries($s){
for ($retry = 0; $retry < $this->max_retries; $retry++){
$_out = curl_exec($s);
+ if($_out === false) {
+ $this->reportHttpError(0, curl_error($s));
+ }
$status = curl_getinfo($s, CURLINFO_HTTP_CODE);
switch ($status) {
case self::HTTP_OK:
@@ -238,7 +241,8 @@ protected function callWithRetries($s){
}
}
curl_close($s);
- return $this->reportHttpError(503, "Service unavailable");
+ $this->reportHttpError(503, "Service unavailable");
+ return null;
}
protected function reportHttpError($status, $text){

0 comments on commit e2c1dce

Please sign in to comment.