Refactor NotFoundException、BadRequestException#4812
Merged
nobodyiam merged 88 commits intoapolloconfig:masterfrom Mar 26, 2023
Merged
Refactor NotFoundException、BadRequestException#4812nobodyiam merged 88 commits intoapolloconfig:masterfrom
nobodyiam merged 88 commits intoapolloconfig:masterfrom
Conversation
# Conflicts: # README.md
hezhangjian
previously approved these changes
Mar 21, 2023
Codecov Report
@@ Coverage Diff @@
## master #4812 +/- ##
============================================
+ Coverage 47.81% 47.98% +0.17%
- Complexity 1672 1703 +31
============================================
Files 346 346
Lines 10665 10694 +29
Branches 1065 1066 +1
============================================
+ Hits 5099 5132 +33
+ Misses 5251 5246 -5
- Partials 315 316 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
nobodyiam
reviewed
Mar 23, 2023
Member
nobodyiam
left a comment
There was a problem hiding this comment.
This is a good try to narrow down the messages. However, there seem 2 patterns to handle the exception:
- BadRequestException.xxx
throw BadRequestException.itemNotExists(itemId);
throw BadRequestException.namespaceNotExists();- new xxxNotFoundException
throw new AppNotFountException(appId);
throw new ClusterNotFoundException(appId, clusterName);Is there a special consideration for this? Or maybe we could unify them to one pattern?
Contributor
Author
|
BadRequestException's HTTP response code is 400, while NotFoundException's HTTP response code is 404.
Yes, it's unified now. throw BadRequestException.userNotExists(operator);
throw NotFoundException.itemNotFound(entity.getKey()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's the purpose of this PR