From c669c268f76507aaa7b0fd2afa890c1bbbf75581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 16 Jun 2025 18:53:28 +0800 Subject: [PATCH] fix NPE --- src/main/java/cn/zhangdeman/exception/CustomException.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/cn/zhangdeman/exception/CustomException.java b/src/main/java/cn/zhangdeman/exception/CustomException.java index cedb88f..5cf96d4 100644 --- a/src/main/java/cn/zhangdeman/exception/CustomException.java +++ b/src/main/java/cn/zhangdeman/exception/CustomException.java @@ -20,6 +20,7 @@ public class CustomException extends RuntimeException { } public CustomException(ICustomExceptionConfig iCustomExceptionConfig) { + super(iCustomExceptionConfig.getMessage()); this.code = iCustomExceptionConfig.getCode(); this.message = iCustomExceptionConfig.getMessage(); this.category = iCustomExceptionConfig.getCategory(); @@ -28,12 +29,14 @@ public class CustomException extends RuntimeException { // 根据code与 public CustomException(ICustomExceptionConfig iCustomExceptionConfig, Object data) { + super(iCustomExceptionConfig.getMessage()); this.code = iCustomExceptionConfig.getCode(); this.message = iCustomExceptionConfig.getMessage(); this.category = iCustomExceptionConfig.getCategory(); this.data = data; } public CustomException(String category, String code, Object data) { + super(HashMapCache.getInstance().getMessage(category, code)); this.category = category; this.code = code; this.message = HashMapCache.getInstance().getMessage(category, code);