From f3cced18d5ef8328b4b7c7da5cf16f56db4cdb53 Mon Sep 17 00:00:00 2001 From: yanglin Date: Fri, 27 Dec 2024 11:25:48 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"REQ-3201:=20=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=AF=B7=E6=B1=82"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e4ce453df5483b37900db4df14282de78512e6da. --- .../msg/center/common/utils/BizAssertions.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/msg-center-common/src/main/java/cn/axzo/msg/center/common/utils/BizAssertions.java b/msg-center-common/src/main/java/cn/axzo/msg/center/common/utils/BizAssertions.java index e5aa48ba..e4da16dc 100644 --- a/msg-center-common/src/main/java/cn/axzo/msg/center/common/utils/BizAssertions.java +++ b/msg-center-common/src/main/java/cn/axzo/msg/center/common/utils/BizAssertions.java @@ -99,8 +99,7 @@ public class BizAssertions { public static T assertResponse(CommonResponse response, String message, Object... args) { if (response == null || response.getCode() != HttpStatus.HTTP_OK) { - ServiceException e = new ServiceException(messageOrTemplateMessage( - response == null ? null : response.getMsg(), message, args)); + ServiceException e = new ServiceException(MessageFormatter.arrayFormat(message, args).getMessage()); log.warn("remote call response with error", e); throw e; } @@ -113,7 +112,7 @@ public class BizAssertions { public static T assertResponse(ApiResult response, String message, Object... args) { if (!response.isSuccess()) { - ServiceException e = new ServiceException(messageOrTemplateMessage(response.getMsg(), message, args)); + ServiceException e = new ServiceException(MessageFormatter.arrayFormat(message, args).getMessage()); log.warn("remote call response with error", e); throw e; } @@ -126,18 +125,11 @@ public class BizAssertions { public static List assertResponse(ApiListResult response, String message, Object... args) { if (!response.isSuccess()) { - ServiceException e = new ServiceException(messageOrTemplateMessage(response.getMsg(), message, args)); + ServiceException e = new ServiceException(MessageFormatter.arrayFormat(message, args).getMessage()); log.warn("remote call response with error", e); throw e; } return response.getData(); } - private static String messageOrTemplateMessage(String message, String template, Object... args) { - if (message != null) { - return message; - } - return MessageFormatter.arrayFormat(template, args).getMessage(); - } - } \ No newline at end of file