From 4a4e1a6a7a876d1a0a52510e7606e64924b33299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 3 Jun 2025 21:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BC=82=E5=B8=B8=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E5=8C=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cn/zhangdeman/CustomException.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; }