summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2023-08-03 11:03:10 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2023-08-03 11:03:10 +0200
commit0fd1d524e5edbe4f197327bfc9cb81596a15350b (patch)
treef4d94f12976f55a669f173fec42eaf75e2d3886e /container-search
parent0f46015e498ecb622473cd3e2403283c99f9f5d5 (diff)
Use `IllegalInputException` to ensure invalid query is returned as 400 response
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java5
2 files changed, 4 insertions, 3 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
index f73ed52246c..7b9fe7da7a2 100644
--- a/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/profile/QueryProfileProperties.java
@@ -108,7 +108,7 @@ public class QueryProfileProperties extends Properties {
/**
* Sets a value in this query profile
*
- * @throws IllegalArgumentException if this property cannot be set in the wrapped query profile
+ * @throws IllegalInputException if this property cannot be set in the wrapped query profile
*/
@Override
public void set(CompoundName name, Object value, Map<String, String> context) {
diff --git a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
index 6c65a5e898a..6203eadffad 100644
--- a/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
+++ b/container-search/src/main/java/com/yahoo/search/query/properties/RankProfileInputProperties.java
@@ -3,6 +3,7 @@ package com.yahoo.search.query.properties;
import com.yahoo.api.annotations.Beta;
import com.yahoo.language.process.Embedder;
+import com.yahoo.processing.IllegalInputException;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
import com.yahoo.search.schema.SchemaInfo;
@@ -46,7 +47,7 @@ public class RankProfileInputProperties extends Properties {
query.getModel().getLanguage());
}
catch (IllegalArgumentException e) {
- throw new IllegalArgumentException("Could not set '" + name + "' to '" + value + "'", e);
+ throw new IllegalInputException("Could not set '" + name + "' to '" + value + "'", e);
}
}
}
@@ -84,7 +85,7 @@ public class RankProfileInputProperties extends Properties {
}
private void throwIllegalInput(CompoundName name, Object value, TensorType expectedType) {
- throw new IllegalArgumentException("Could not set '" + name + "' to '" + value + "': " +
+ throw new IllegalInputException("Could not set '" + name + "' to '" + value + "': " +
"This input is declared in rank profile '" + query.getRanking().getProfile() +
"' as " + expectedType);
}