You are here

protected function SearchApiSolrConnection::checkResponse in Search API Solr 7

Checks the reponse code and throws an exception if it's not 200.

Parameters

object $response: A response object.

Return value

object The passed response object.

Throws

SearchApiException If the object's HTTP status is not 200.

3 calls to SearchApiSolrConnection::checkResponse()
SearchApiSolrConnection::makeServletRequest in includes/solr_connection.inc
Makes a request to a servlet (a path) that's not a standard path.
SearchApiSolrConnection::sendRawGet in includes/solr_connection.inc
Sends a GET request to the Solr server.
SearchApiSolrConnection::sendRawPost in includes/solr_connection.inc
Sends a PUT request to the Solr server.

File

includes/solr_connection.inc, line 538

Class

SearchApiSolrConnection
Represents a Solr server resource.

Code

protected function checkResponse($response) {
  $code = (int) $response->code;
  if ($code != 200) {
    if ($code >= 400 && $code != 403 && $code != 404) {

      // Add details, like Solr's exception message.
      $response->status_message .= $response->data;
    }
    throw new SearchApiException('"' . $code . '" Status: ' . $response->status_message);
  }
  return $response;
}