summaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/grouping
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-08-18 11:15:50 +0200
committerJon Bratseth <bratseth@gmail.com>2020-08-18 11:15:50 +0200
commitc30bbdb0fa50cedc56eec71feeadc969ba5a3edf (patch)
tree6935b4d042618900ee0f7fd291c14ed55ae06cf8 /container-search/src/test/java/com/yahoo/search/grouping
parent529694a88d48270298171fdcb87d1439f183202b (diff)
Skip logging only for IllegalInputException
- Add IllegalInputException to signal cases where we know the exception is caused by illegal input received from the requestor. - Only skip logging for IllegalInputException instead of the superclass IllegalArgumentException as that is also used to signal illegal arguments to methods due to bugs which are otherwise hard to debug. - Throw IllegalInputException rather than IllegalArgumentException where appropriate. - Deprecated QueryException as it was only used to be able to separate between query string and query parameter exceptions, and not doing that consistently, and is in a package we don't want more use of. - Clean up some cases where the wrong exception was thrown.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/grouping')
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
index 8ff03b35b60..86ab96a2197 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/UniqueGroupingSearcherTestCase.java
@@ -2,7 +2,6 @@
package com.yahoo.search.grouping;
import com.yahoo.component.chain.Chain;
-import com.yahoo.prelude.query.QueryException;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
@@ -41,18 +40,19 @@ public class UniqueGroupingSearcherTestCase {
new MockResultProvider(0, false));
assertEquals(0, result.hits().size());
}
+
@Test
public void testIllegalSortingSpec() {
try {
search("?query=foo&unique=fingerprint&sorting=-1",
new MockResultProvider(0, true).addGroupList(new GroupList("fingerprint")));
fail("Above statement should throw");
- } catch (QueryException e) {
+ } catch (IllegalArgumentException e) {
// As expected.
assertThat(
Exceptions.toMessageString(e),
containsString(
- "Invalid request parameter: Could not set 'ranking.sorting' to '-1': " +
+ "Could not set 'ranking.sorting' to '-1': " +
"Illegal attribute name '1' for sorting. Requires '[\\[]*[a-zA-Z_][\\.a-zA-Z0-9_-]*[\\]]*'"));
}
}