diff --git a/src/main/java/cn/zhangdeman/CustomException.java b/src/main/java/cn/zhangdeman/CustomException.java index 2b218f7..85753fc 100644 --- a/src/main/java/cn/zhangdeman/CustomException.java +++ b/src/main/java/cn/zhangdeman/CustomException.java @@ -21,6 +21,13 @@ public class CustomException extends RuntimeException { this.message = message; } + public CustomException(ICustomExceptionConfig iCustomExceptionConfig) { + this.code = iCustomExceptionConfig.getCode(); + this.message = iCustomExceptionConfig.getMessage(); + this.category = iCustomExceptionConfig.getCategory(); + this.data = null; + } + // 根据code与 public CustomException(ICustomExceptionConfig iCustomExceptionConfig, Object data) { this.code = iCustomExceptionConfig.getCode(); @@ -31,7 +38,7 @@ public class CustomException extends RuntimeException { public CustomException(String category, String code, Object data) { this.category = category; this.code = code; - this.message = HashMapCache.getInstance().getCodeMessage(category, code); + this.message = HashMapCache.getInstance().getMessage(category, code); this.data = data; }