-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
- 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 Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
... 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"); |
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.
Don't do assertion error in production code. You may use Utils.rethrowException(ioe)
to workaround the checked exception if you prefer that way
throw new AssertionError("Should not reach this"); | |
throw new RuntimeException("Caught exception serializing the response", ioe); |
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.
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.
3a8dfed
to
bba1d75
Compare
This PR:
this fixes: #11593