-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Adding downstream source when throwing QueryInterruptedException #1773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -478,8 +478,14 @@ private void init() | |
| jp = objectMapper.getFactory().createParser(future.get()); | ||
| final JsonToken nextToken = jp.nextToken(); | ||
| if (nextToken == JsonToken.START_OBJECT) { | ||
| QueryInterruptedException e = jp.getCodec().readValue(jp, QueryInterruptedException.class); | ||
| throw e; | ||
| QueryInterruptedException cause = jp.getCodec().readValue(jp, QueryInterruptedException.class); | ||
| //case we get an exception with an unknown message. | ||
| if (cause.isNotKnown()) { | ||
| throw new QueryInterruptedException(QueryInterruptedException.UNKNOWN_EXCEPTION, cause.getMessage(), host); | ||
| } else { | ||
| throw new QueryInterruptedException(cause, host); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will be a QueryInterruptedException in a QueryInterruptedException. I think that's ok, but is it intended?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this is deserializing a remote exception, this "re-wrapping" works as a demarcation point between the remote and the local. Seems potentially useful to me... If nothing else, it might just be some extra stuff on the exception, but it shouldn't make it more difficult to track down what happened.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very reasonable. Just wanted to make sure that was the intended use here. |
||
| } | ||
|
|
||
| } else if (nextToken != JsonToken.START_ARRAY) { | ||
| throw new IAE("Next token wasn't a START_ARRAY, was[%s] from url [%s]", jp.getCurrentToken(), url); | ||
| } else { | ||
|
|
@@ -491,7 +497,7 @@ private void init() | |
| throw new RE(e, "Failure getting results from[%s] because of [%s]", url, e.getMessage()); | ||
| } | ||
| catch (CancellationException e) { | ||
| throw new QueryInterruptedException("Query cancelled"); | ||
| throw new QueryInterruptedException(e, host); | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a unit test for this method that hits the branches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drcrallen and @cheddar the current UT test this branch by this code if you have another idea in mind please let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither of those two branches were hit in anything I could find.
I was asking if you could add a basic unit test to explicitly hit the branches in this method.