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

Commit 24ba95b

Browse files
committed
Merge pull request #116 from J7mbo/curl_error
cURL errors now throw exceptions
2 parents 7800b9f + 8053534 commit 24ba95b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

TwitterAPIExchange.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ public function buildOauth($url, $requestMethod)
246246
*/
247247
public function performRequest($return = true)
248248
{
249-
if (!is_bool($return))
250-
{
251-
throw new Exception('performRequest parameter must be true or false');
249+
if (!is_bool($return))
250+
{
251+
throw new Exception('performRequest parameter must be true or false');
252252
}
253253

254254
$header = array($this->buildAuthorizationHeader($this->oauth), 'Expect:');
255-
255+
256256
$getfield = $this->getGetfield();
257257
$postfields = $this->getPostfields();
258258

@@ -279,6 +279,14 @@ public function performRequest($return = true)
279279
$feed = curl_init();
280280
curl_setopt_array($feed, $options);
281281
$json = curl_exec($feed);
282+
283+
if (($error = curl_error($feed)) !== '')
284+
{
285+
curl_close($feed);
286+
287+
throw new \Exception($error);
288+
}
289+
282290
curl_close($feed);
283291

284292
return $json;

0 commit comments

Comments
 (0)