mall + pay:调整异常的处理

1. 如果是业务异常,则统一转换成 ServiceException
2. 如果是系统异常,则使用 PayException 包装成无需 check 的异常
This commit is contained in:
YunaiV
2023-07-08 19:26:42 +08:00
parent e615be971e
commit efb221b1fe
13 changed files with 133 additions and 102 deletions

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.common.exception.util;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
@ -80,6 +81,10 @@ public class ServiceExceptionUtil {
return new ServiceException(code, message);
}
public static ServiceException invalidParamException(String messagePattern, Object... params) {
return exception0(GlobalErrorCodeConstants.BAD_REQUEST.getCode(), messagePattern, params);
}
// ========== 格式化方法 ==========
/**