diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:31:33 -0400 |
commit | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (patch) | |
tree | 181f454813b310ee97385058c6c6f2e3f34d5fd8 /vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php | |
parent | 7e85254903c7c0cb49e381f16b18441ea7b058cc (diff) | |
parent | 80f7dc77d430774192b929d780f96260066df2ee (diff) |
Merge commit '80f7dc'
# Conflicts:
# extensions/ArchInterWiki.sql
Diffstat (limited to 'vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php')
-rw-r--r-- | vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php b/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php deleted file mode 100644 index 2a36fe48..00000000 --- a/vendor/ruflin/elastica/lib/Elastica/Exception/Connection/HttpException.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace Elastica\Exception\Connection; - -use Elastica\Exception\ConnectionException; -use Elastica\Request; -use Elastica\Response; - -/** - * Connection exception - * - * @category Xodoa - * @package Elastica - * @author Nicolas Ruflin <spam@ruflin.com> - */ -class HttpException extends ConnectionException -{ - /** - * Error code / message - * - * @var string Error code / message - */ - protected $_error = 0; - - /** - * Construct Exception - * - * @param string $error Error - * @param \Elastica\Request $request - * @param \Elastica\Response $response - */ - public function __construct($error, Request $request = null, Response $response = null) - { - $this->_error = $error; - - $message = $this->getErrorMessage($this->getError()); - parent::__construct($message, $request, $response); - } - - /** - * Returns the error message corresponding to the error code - * cUrl error code reference can be found here {@link http://curl.haxx.se/libcurl/c/libcurl-errors.html} - * - * @param string $error Error code - * @return string Error message - */ - public function getErrorMessage($error) - { - switch ($error) { - case CURLE_UNSUPPORTED_PROTOCOL: - $error = "Unsupported protocol"; - break; - case CURLE_FAILED_INIT: - $error = "Internal cUrl error?"; - break; - case CURLE_URL_MALFORMAT: - $error = "Malformed URL"; - break; - case CURLE_COULDNT_RESOLVE_PROXY: - $error = "Couldn't resolve proxy"; - break; - case CURLE_COULDNT_RESOLVE_HOST: - $error = "Couldn't resolve host"; - break; - case CURLE_COULDNT_CONNECT: - $error = "Couldn't connect to host, Elasticsearch down?"; - break; - case 28: - $error = "Operation timed out"; - break; - default: - $error = "Unknown error:" . $error; - break; - } - - return $error; - } - - /** - * Return Error code / message - * - * @return string Error code / message - */ - public function getError() - { - return $this->_error; - } -} |