Skip to content
Snippets Groups Projects
Commit 617b00ee authored by Adrian Lorenc's avatar Adrian Lorenc
Browse files

ISAICP-9456: Improve error logging.

parent 6afabfcb
No related branches found
No related tags found
1 merge request!209Release 2.2.0
......@@ -6,6 +6,7 @@
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use GuzzleHttp\Exception\RequestException;
/**
* Represents a cached SPARQL read-only endpoint.
......@@ -59,10 +60,18 @@ protected function getSparqlResponse(string $query, ?string $accept = NULL): Spa
try {
$endpointResponse = $this->sparqlReadOnlyEndpoint->query($query, $accept);
}
catch (RequestException $e) {
return new SparqlResponse(
$e->getCode(),
$e->getResponse() ? $e->getResponse()
->getBody()
->getContents() : 'No response available'
);
}
catch (\Exception $e) {
return new SparqlResponse(
$e->getCode(),
$e->getResponse()->getBody()->getContents()
'Error: ' . $e->getMessage()
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment