Revert "REQ-3201: 记录请求"

This reverts commit e4ce453df5.
This commit is contained in:
yanglin 2024-12-27 11:25:48 +08:00
parent e4ce453df5
commit f3cced18d5

View File

@ -99,8 +99,7 @@ public class BizAssertions {
public static <T> T assertResponse(CommonResponse<T> response, String message, Object... args) { public static <T> T assertResponse(CommonResponse<T> response, String message, Object... args) {
if (response == null || response.getCode() != HttpStatus.HTTP_OK) { if (response == null || response.getCode() != HttpStatus.HTTP_OK) {
ServiceException e = new ServiceException(messageOrTemplateMessage( ServiceException e = new ServiceException(MessageFormatter.arrayFormat(message, args).getMessage());
response == null ? null : response.getMsg(), message, args));
log.warn("remote call response with error", e); log.warn("remote call response with error", e);
throw e; throw e;
} }
@ -113,7 +112,7 @@ public class BizAssertions {
public static <T> T assertResponse(ApiResult<T> response, String message, Object... args) { public static <T> T assertResponse(ApiResult<T> response, String message, Object... args) {
if (!response.isSuccess()) { 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); log.warn("remote call response with error", e);
throw e; throw e;
} }
@ -126,18 +125,11 @@ public class BizAssertions {
public static <T> List<T> assertResponse(ApiListResult<T> response, String message, Object... args) { public static <T> List<T> assertResponse(ApiListResult<T> response, String message, Object... args) {
if (!response.isSuccess()) { 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); log.warn("remote call response with error", e);
throw e; throw e;
} }
return response.getData(); return response.getData();
} }
private static String messageOrTemplateMessage(String message, String template, Object... args) {
if (message != null) {
return message;
}
return MessageFormatter.arrayFormat(template, args).getMessage();
}
} }