diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-08-18 11:15:50 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-08-18 11:15:50 +0200 |
commit | c30bbdb0fa50cedc56eec71feeadc969ba5a3edf (patch) | |
tree | 6935b4d042618900ee0f7fd291c14ed55ae06cf8 /container-search/src/main/java/com/yahoo/search/yql/YqlParser.java | |
parent | 529694a88d48270298171fdcb87d1439f183202b (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/main/java/com/yahoo/search/yql/YqlParser.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/yql/YqlParser.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java b/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java index 31a22fd3b58..3875018609e 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java +++ b/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java @@ -67,6 +67,7 @@ import com.yahoo.prelude.query.WeakAndItem; import com.yahoo.prelude.query.WeightedSetItem; import com.yahoo.prelude.query.WordAlternativesItem; import com.yahoo.prelude.query.WordItem; +import com.yahoo.processing.IllegalInputException; import com.yahoo.search.Query; import com.yahoo.search.grouping.Continuation; import com.yahoo.search.grouping.request.GroupingOperation; @@ -318,10 +319,10 @@ public class YqlParser implements Parser { private void connectItems() { for (ConnectedItem entry : connectedItems) { TaggableItem to = identifiedItems.get(entry.toId); - Preconditions.checkNotNull(to, - "Item '%s' was specified to connect to item with ID %s, which does not " - + "exist in the query.", entry.fromItem, - entry.toId); + if (to == null) + throw new IllegalArgumentException("Item '" + entry.fromItem + + "' was specified to connect to item with ID " + entry.toId + + ", which does not exist in the query."); entry.fromItem.setConnectivity((Item) to, entry.weight); } } @@ -782,7 +783,7 @@ public class YqlParser implements Parser { try { ast = new ProgramParser().parse("query", currentlyParsing.getQuery()); } catch (Exception e) { - throw new IllegalArgumentException(e); + throw new IllegalInputException(e); } assertHasOperator(ast, StatementOperator.PROGRAM); Preconditions.checkArgument(ast.getArguments().length == 1, |