blob: 499cbd7da21d878fa2024f1909dbbd4acd21e310 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?php
namespace Elastica\Exception\Connection;
use Elastica\Exception\ConnectionException;
use Elastica\Request;
use Elastica\Response;
use Thrift\Exception\TException;
/**
* Transport exception.
*
* @author Mikhail Shamin <munk13@gmail.com>
*/
class ThriftException extends ConnectionException
{
/**
* @var TException
*/
protected $_thriftException;
/**
* @param \Thrift\Exception\TException $thriftException
* @param \Elastica\Request $request
* @param \Elastica\Response $response
*/
public function __construct(TException $thriftException, Request $request = null, Response $response = null)
{
$this->_thriftException = $thriftException;
$message = $this->getErrorMessage($this->getThriftException());
parent::__construct($message, $request, $response);
}
/**
* @param \Thrift\Exception\TException $thriftException
*
* @return string
*/
public function getErrorMessage(TException $thriftException)
{
return $thriftException->getMessage();
}
/**
* @return TException
*/
public function getThriftException()
{
return $this->_thriftException;
}
}
|