You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/03/18 09:41:58 UTC

[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull request #4825: orchestration mode code optimization .

kimmking commented on a change in pull request #4825: orchestration mode code optimization .
URL: https://github.com/apache/incubator-shardingsphere/pull/4825#discussion_r394214545
 
 

 ##########
 File path: sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-common/src/main/java/org/apache/shardingsphere/orchestration/core/common/CenterType.java
 ##########
 @@ -41,6 +42,8 @@
      * @return OrchestrationType enum, return {@code null} if not found
      */
     public static CenterType findByValue(final String value) {
-        return Arrays.stream(CenterType.values()).filter(each -> each.getValue().equals(value)).findFirst().get();
+        return Arrays.stream(CenterType.values())
+                .filter(each -> each.getValue().equals(value)).findFirst()
+                .orElseThrow(() -> new OrchestrationException("now only support :{},{}", "registry_center", "config_center"));
 
 Review comment:
   good.
   but static field referred better than literal string.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services