Skip to content

Commit

Permalink
Simplify guzzle exception handling
Browse files Browse the repository at this point in the history
Signed-off-by: Fadion Dashi <[email protected]>
  • Loading branch information
fadion committed Nov 20, 2015
1 parent 2df98e3 commit 5c9aa40
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Fadion\Fixerio\Exceptions\ResponseException;
use Fadion\Fixerio\Exceptions\ConnectionException;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\TransferException;

class Exchange
{
Expand Down Expand Up @@ -167,10 +166,7 @@ public function get()
}
// The client needs to know only one exception, no
// matter what exception is thrown by Guzzle
catch (ConnectException $e) {
throw new ConnectionException($e->getMessage());
}
catch (ClientException $e) {
catch (TransferException $e) {
throw new ConnectionException($e->getMessage());
}
}
Expand Down

0 comments on commit 5c9aa40

Please sign in to comment.