win120a commented on PR #10599:
URL: https://github.com/apache/dubbo/pull/10599#issuecomment-1242754122

   有个想法,就是不知道能不能把不同模块的错误码作为一个个内部类,这样子是不是更好找点?比如这样:
   
   另外,这边认为用 final 类 + 私有构造器更好些,因为这边让其他类去 “实现” 这个接口不太合适。
   
   ```java
   public final class LoggerCodeConstants {
       private LoggerCodeConstants() {
           throw new UnsupportedOperationException("...");
       }
       // 下面的内部类的私有构造器省略。
   
       public static final class CommonModuleErrorCodeConstants {
           // common module 0-1 ~ 0-4
           public static final String COMMON_THREAD_POOL_EXHAUSTED = "0-1";
         
           public static final String COMMON_PROPERTY_MISSPELLING = "0-2";
         
           public static final String COMMON_CACHE_PATH_INACCESSIBLE = "0-3";
         
           public static final String COMMON_CACHE_FILE_EXCEED_MAXIMUM_LIMIT = 
"0-4";
       }
   
       public static final class RegistryModuleErrorCodeConstants {
           // registry module
           public static final String REGISTRY_ADDRESS_INVALID = "1-1";
         
           public static final String REGISTRY_ABSENCE = "1-2";
         
           public static final String REGISTRY_FAILED_URL_EVICTING = "1-3";
       }
   
       // .....
   }
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to