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
Fix parsing error messages returned to FileUploadDownloadClient #7428
Fix parsing error messages returned to FileUploadDownloadClient #7428
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7428 +/- ##
============================================
- Coverage 69.83% 69.76% -0.07%
+ Complexity 3258 3251 -7
============================================
Files 1123 1123
Lines 53133 53133
Branches 8008 8008
============================================
- Hits 37106 37069 -37
- Misses 13397 13433 +36
- Partials 2630 2631 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -509,7 +509,7 @@ private static String getErrorMessage(HttpUriRequest request, CloseableHttpRespo | |||
StatusLine statusLine = response.getStatusLine(); | |||
String reason; | |||
try { | |||
reason = JsonUtils.stringToJsonNode(EntityUtils.toString(response.getEntity())).get("error").asText(); | |||
reason = JsonUtils.stringToJsonNode(EntityUtils.toString(response.getEntity())).get("_error").asText(); |
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.
Could you put a sample entity to the description of this PR to show what is included in the entity?
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.
Done.
@@ -509,7 +509,7 @@ private static String getErrorMessage(HttpUriRequest request, CloseableHttpRespo | |||
StatusLine statusLine = response.getStatusLine(); | |||
String reason; | |||
try { | |||
reason = JsonUtils.stringToJsonNode(EntityUtils.toString(response.getEntity())).get("error").asText(); | |||
reason = JsonUtils.stringToJsonNode(EntityUtils.toString(response.getEntity())).get("_error").asText(); | |||
} catch (Exception e) { | |||
reason = "Failed to get reason"; |
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.
Could we also print out some useful info (like the raw output) if any exception is throw when parsing the entity?
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.
The whole purpose of this method, getErrorMessage
is to have a nicer log message. It defeats its purpose if we log/print out something here. With the bug fix, it should work as intended.
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.
LGTM. Thanks for working on this!
The integration test keeps failing on this test:
Let's wait for the following PR to be merged before merging this PR: |
@jackjlli @sajjad-moradi Maybe we should rebase based on the master branch and re-trigger the test. |
2bb2fd0
to
13e56ee
Compare
13e56ee
to
3467be4
Compare
Description
FileUploadDownloadClient
uses a wrong field name to extract the error message from Entity of HttpResponse.Sample response entity:
This PR uses the correct field name.
Testing Done
Modified
OfflineClusterIntegrationTest
to generate a quota error.Error message before the fix:
Error message after the fix: