From c053208387bfa85872fbd93829641a4da901a819 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Fri, 24 Jan 2014 09:04:49 -0500 Subject: [PATCH] /Indices/Warmer/Get should throw exception on bad argument combination If `index` and `type` are specified but not `name`, an exception should be thrown sinc this is an illegal combination. Valid combinations are: "/_warmer", "/{index}/_warmer", "/{index}/_warmer/{name}", "/_warmer/{name}", "/{index}/{type}/_warmer/{name}" --- src/Elasticsearch/Endpoints/Indices/Warmer/Get.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Elasticsearch/Endpoints/Indices/Warmer/Get.php b/src/Elasticsearch/Endpoints/Indices/Warmer/Get.php index d21307050..5c7055aa2 100644 --- a/src/Elasticsearch/Endpoints/Indices/Warmer/Get.php +++ b/src/Elasticsearch/Endpoints/Indices/Warmer/Get.php @@ -43,6 +43,7 @@ public function setName($name) /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException * @return string */ protected function getURI() @@ -56,6 +57,8 @@ protected function getURI() $uri = "/$index/$type/_warmer/$name"; } elseif (isset($index) === true && isset($name) === true) { $uri = "/$index/_warmer/$name"; + } elseif (isset($index) === true && isset($type) === true) { + throw new Exceptions\RuntimeException('Invalid index/type/name combination. If index + type are defined, name must also be defined'); } elseif (isset($index) === true) { $uri = "/$index/_warmer"; } elseif (isset($name) === true) {