Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Merge pull request #116 from J7mbo/curl_error
Browse files Browse the repository at this point in the history
cURL errors now throw exceptions
  • Loading branch information
J7mbo committed May 10, 2015
2 parents 7800b9f + 8053534 commit 24ba95b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions TwitterAPIExchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ public function buildOauth($url, $requestMethod)
*/
public function performRequest($return = true)
{
if (!is_bool($return))
{
throw new Exception('performRequest parameter must be true or false');
if (!is_bool($return))
{
throw new Exception('performRequest parameter must be true or false');
}

$header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:');

$getfield = $this->getGetfield();
$postfields = $this->getPostfields();

Expand All @@ -279,6 +279,14 @@ public function performRequest($return = true)
$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);

if (($error = curl_error($feed)) !== '')
{
curl_close($feed);

throw new \Exception($error);
}

curl_close($feed);

return $json;
Expand Down

0 comments on commit 24ba95b

Please sign in to comment.