protected function SolrConnectorPluginBase::handleHttpException in Search API Solr 8
Same name and namespace in other branches
- 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::handleHttpException()
- 8.2 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::handleHttpException()
- 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::handleHttpException()
Converts a HttpException in an easier to read SearchApiSolrException.
Parameters
\Solarium\Exception\HttpException $e:
\Solarium\Core\Client\Endpoint $endpoint:
Throws
\Drupal\search_api_solr\SearchApiSolrException
2 calls to SolrConnectorPluginBase::handleHttpException()
- SolrConnectorPluginBase::execute in src/
SolrConnector/ SolrConnectorPluginBase.php - Executes any query.
- SolrConnectorPluginBase::executeRequest in src/
SolrConnector/ SolrConnectorPluginBase.php - Executes a request and returns the response.
File
- src/
SolrConnector/ SolrConnectorPluginBase.php, line 876
Class
- SolrConnectorPluginBase
- Defines a base class for Solr connector plugins.
Namespace
Drupal\search_api_solr\SolrConnectorCode
protected function handleHttpException(HttpException $e, Endpoint $endpoint) {
$response_code = $e
->getCode();
switch ($response_code) {
case 404:
$description = $this
->t('not found');
break;
case 401:
case 403:
$description = $this
->t('access denied');
break;
default:
$description = $this
->t('unreachable');
}
throw new SearchApiSolrException($this
->t('Solr endpoint @endpoint @description.', [
'@endpoint' => $endpoint
->getBaseUri(),
'@description' => $description,
]), $response_code, $e);
}