Skip to content
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

modify the error response on controller. #11624

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

walterddr
Copy link
Contributor

@walterddr walterddr commented Sep 19, 2023

This PR:

  • return will always be JSON format if process error occurred.
  • when there's web/network/app issue, strictly non 2xx error code should be there for http response

this fixes: #11593

- return will always be JSON format if process error occurred.
- when there's web/network/app issue, strictly non 2xx error code should
be there for http response
@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2023

Codecov Report

Merging #11624 (bba1d75) into master (e123642) will decrease coverage by 48.59%.
Report is 13 commits behind head on master.
The diff coverage is 0.00%.

@@              Coverage Diff              @@
##             master   #11624       +/-   ##
=============================================
- Coverage     63.05%   14.46%   -48.59%     
+ Complexity     1105      201      -904     
=============================================
  Files          2325     2335       +10     
  Lines        124913   125216      +303     
  Branches      19146    19209       +63     
=============================================
- Hits          78758    18110    -60648     
- Misses        40533   105578    +65045     
+ Partials       5622     1528     -4094     
Flag Coverage Δ
integration ?
integration1 ?
integration2 ?
java-11 14.45% <0.00%> (-48.56%) ⬇️
java-17 14.45% <0.00%> (-48.45%) ⬇️
java-20 14.45% <0.00%> (-48.48%) ⬇️
temurin 14.46% <0.00%> (-48.59%) ⬇️
unittests 14.46% <0.00%> (-48.59%) ⬇️
unittests1 ?
unittests2 14.46% <0.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...t/controller/api/resources/PinotQueryResource.java 0.00% <0.00%> (ø)

... and 1521 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

try {
return new BrokerResponseNative(pe).toJsonString();
} catch (IOException ioe) {
throw new AssertionError("Should not reach this");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do assertion error in production code. You may use Utils.rethrowException(ioe) to workaround the checked exception if you prefer that way

Suggested change
throw new AssertionError("Should not reach this");
throw new RuntimeException("Caught exception serializing the response", ioe);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah Utils rethrow should be the best. although it should never reach here anyway b/c the constructed response will always be a valid json.

@Jackie-Jiang Jackie-Jiang added enhancement user-experience Related to user experience and removed feature labels Sep 20, 2023
@walterddr walterddr merged commit 4226ea0 into apache:master Sep 21, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query response code/content is confusing
3 participants