# Class yii\elasticsearch\Exception

Inheritance | yii\elasticsearch\Exception » yii\db\Exception » yii\base\Exception » Exception
Available since version | 2.0
Source Code | https://github.com/yiisoft/yii2-elasticsearch/blob/master/Exception.php

Exception represents an exception that is caused by Elasticsearch-related operations.

## Public Properties

Hide inherited properties

Property | Type | Description | Defined By
--- | --- | --- | ---
$errorInfo | array | The error info provided by a PDO exception. | yii\db\Exception

## Public Methods

Hide inherited methods

Method | Description | Defined By
--- | --- | ---
__construct() | Constructor. | yii\db\Exception
__toString() |  | yii\db\Exception
getName() |  | yii\elasticsearch\Exception

## Method Details

Hide inherited methods

__construct() public method

Defined in: yii\db\Exception::__construct()

Constructor.

public void __construct ( $message, $errorInfo = [], $code = '', $previous = null )
$message | string | PDO error message
$errorInfo | array | PDO error info
$code | string | PDO error code
$previous | Throwable|null | The previous exception used for the exception chaining.

Source code

                    public function __construct($message, $errorInfo = [], $code = '', $previous = null)
    {
        parent::__construct($message, 0, $previous);
        $this->errorInfo = $errorInfo;
        $this->code = $code;
    }

__toString() public method

Defined in: yii\db\Exception::__toString()

public string __toString ( )
return | string | Readable representation of exception

Source code

                    public function __toString()
    {
        return parent::__toString() . PHP_EOL
        . 'Additional Information:' . PHP_EOL . print_r($this->errorInfo, true);
    }

getName() public method

public string getName ( )
return | string | The user-friendly name of this exception

Source code

                    public function getName()
    {
        return 'Elasticsearch Database Exception';
    }