Commit dd31cb98 authored by Felip Manyer i Ballester's avatar Felip Manyer i Ballester
Browse files

Wrong exception handling

parent a35e8f72
Pipeline #94 passed with stages
in 6 seconds
......@@ -2,8 +2,8 @@
namespace ResTelae\Gbif;
use Guzzle\Http\Exception\RequestException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
/**
* GBIF: generic class.
......@@ -48,12 +48,8 @@ abstract class Gbif {
try {
$response = $this->gbifClient->get($uri, ['query' => $query_string]);
}
catch (RequestException $e) {
$msg = (string) $e->getRequest();
if ($e->hasResponse) {
$msg .= (string) $e->getResponse();
throw new GbifException($msg);
}
catch (ClientException $e) {
throw new GbifException($e->getResponse()->getBody()->getContents());
}
$data = (string) $response->getBody();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment