Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Res Telæ
PHP GBIF
Commits
dd31cb98
Commit
dd31cb98
authored
Feb 09, 2021
by
Felip Manyer i Ballester
Browse files
Wrong exception handling
parent
a35e8f72
Pipeline
#94
passed with stages
in 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Gbif.php
View file @
dd31cb98
...
...
@@ -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
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment