-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Refactor NotFoundException、BadRequestException #4812
Conversation
# Conflicts: # README.md
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. |
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.
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?
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()); |
...ce/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceAcquireLockAspect.java
Show resolved
Hide resolved
...lo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java
Show resolved
Hide resolved
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
What's the purpose of this PR