diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-02-03 06:21:30 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-02-03 06:21:30 +0100 |
| commit | 226508cd8d3e8c147ad314a0de483e08be71c254 (patch) | |
| tree | 4142696d28830efa13835be79fd3ee888a4ab0a4 /src/Elasticsearch | |
| parent | 7b4425b096fa8c18d0db9fd9b1ae96d63ee8af55 (diff) | |
| download | phinde-226508cd8d3e8c147ad314a0de483e08be71c254.tar.gz phinde-226508cd8d3e8c147ad314a0de483e08be71c254.zip | |
first frontend
Diffstat (limited to 'src/Elasticsearch')
| -rw-r--r-- | src/Elasticsearch/Request.php | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/Elasticsearch/Request.php b/src/Elasticsearch/Request.php deleted file mode 100644 index 7bb6add..0000000 --- a/src/Elasticsearch/Request.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -namespace phinde; - -class Elasticsearch_Request extends \HTTP_Request2 -{ - public $allow404 = false; - - public function send() - { - $res = parent::send(); - $mainCode = intval($res->getStatus() / 100); - if ($mainCode === 2) { - return $res; - } - - if ($this->allow404 && $res->getStatus() == 404) { - return $res; - } - $js = json_decode($res->getBody()); - if (isset($js->error)) { - $error = json_encode($js->error); - } else { - $error = $res->getBody(); - } - - throw new \Exception( - 'Error in elasticsearch communication at ' - . $this->getMethod() . ' ' . (string) $this->getUrl() - . ' (status code ' . $res->getStatus() . '): ' - . $error - ); - } -} - -?> |
