Skip to content

Commit

Permalink
better exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbugli committed Jun 24, 2014
1 parent 99fda46 commit 146afe6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/GetStream/Stream/Feed.php
Expand Up @@ -3,7 +3,10 @@

use GuzzleHttp;
use GuzzleHttp\Exception\ClientErrorResponseException;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerErrorResponse;
use \Exception;


class Feed extends BaseFeed
{
Expand Down Expand Up @@ -34,8 +37,8 @@ public function makeHttpRequest($uri, $method, $data = null, $query_params = nul
try {
$response = $client->send($request);
} catch (Exception $e) {
if ($e instanceof ClientErrorResponseException || $e instanceof ServerErrorResponse) {
throw new StreamFeedException($e->getResponse());
if ($e instanceof ClientErrorResponseException || $e instanceof ServerErrorResponse || $e instanceof ClientException) {
throw new StreamFeedException($e->getResponse()->getBody());
} else {
throw $e;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/GetStream/Stream/StreamFeedException.php
@@ -1,6 +1,6 @@
<?php
namespace GetStream\Stream;

class StreamFeedException extends Exception
class StreamFeedException extends \Exception
{
}

0 comments on commit 146afe6

Please sign in to comment.