CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\ElasticaErrorHandler Class Reference

Generic functions for extracting and reporting on errors/exceptions from Elastica. More...

Static Public Member Functions

static logRequestResponse (Connection $conn, $message, array $context=[])
 
static extractMessage (\Elastica\Exception\ExceptionInterface $exception)
 
static extractFullError (\Elastica\Exception\ExceptionInterface $exception)
 Extract an error message from an exception thrown by Elastica.
 
static classifyError (\Elastica\Exception\ExceptionInterface $exception=null)
 Broadly classify the error message into failures where we decided to not serve the query, and failures where we just failed to answer.
 
static isParseError (Status $status)
 Does this status represent an Elasticsearch parse error?
 
static extractMessageAndStatus (\Elastica\Exception\ExceptionInterface $exception=null)
 

Static Protected Member Functions

static formatMessage (array $error)
 Takes an error and converts it into a useful message.
 

Detailed Description

Generic functions for extracting and reporting on errors/exceptions from Elastica.

Member Function Documentation

◆ classifyError()

static CirrusSearch\ElasticaErrorHandler::classifyError ( \Elastica\Exception\ExceptionInterface $exception = null)
static

Broadly classify the error message into failures where we decided to not serve the query, and failures where we just failed to answer.

Parameters
\Elastica\Exception\ExceptionInterface | null$exception
Returns
string Either 'rejected', 'failed' or 'unknown'

◆ extractFullError()

static CirrusSearch\ElasticaErrorHandler::extractFullError ( \Elastica\Exception\ExceptionInterface $exception)
static

Extract an error message from an exception thrown by Elastica.

Parameters
\Elastica\Exception\ExceptionInterface$exceptionexception from which to extract a message
Returns
array structuerd error from the exception

◆ extractMessage()

static CirrusSearch\ElasticaErrorHandler::extractMessage ( \Elastica\Exception\ExceptionInterface $exception)
static
Parameters
\Elastica\Exception\ExceptionInterface$exception
Returns
string

◆ extractMessageAndStatus()

static CirrusSearch\ElasticaErrorHandler::extractMessageAndStatus ( \Elastica\Exception\ExceptionInterface $exception = null)
static
Parameters
\Elastica\Exception\ExceptionInterface | null$exception
Returns
array Two elements, first is Status object, second is string.

◆ formatMessage()

static CirrusSearch\ElasticaErrorHandler::formatMessage ( array $error)
staticprotected

Takes an error and converts it into a useful message.

Mostly this is to deal with errors where the useful part is hidden inside a caused_by chain. WARNING: In some circumstances, like bulk update failures, this could be multiple megabytes.

Parameters
array$errorAn error array, such as the one returned by extractFullError().
Returns
string

◆ isParseError()

static CirrusSearch\ElasticaErrorHandler::isParseError ( Status $status)
static

Does this status represent an Elasticsearch parse error?

Parameters
Status$statusStatus to check
Returns
bool is this a parse error?
Todo
No good replacements for getErrorsArray

The documentation for this class was generated from the following file: