Files
senmesh-zc/src/main/java/com/senmesh/common/exception/util/ExceptionUtils.java

49 lines
1.0 KiB
Java
Raw Normal View History

2025-12-29 16:06:48 +08:00
package com.senmesh.common.exception.util;
2025-06-11 09:42:13 +08:00
2025-12-29 16:06:48 +08:00
import com.senmesh.common.exception.BusinessException;
2025-06-11 09:42:13 +08:00
import lombok.extern.slf4j.Slf4j;
/**
* 异常工具类
* @author sr on 2019-10-14
*/
@Slf4j
public class ExceptionUtils {
/**
* @Description 抛异常
* @Author chenyun.huang
* @Date 2020/3/27 15:06
**/
public static void throwBusinessException(String msg) {
ExceptionUtils.throwBusinessException(true,msg);
}
/**
* 根据判断抛异常
* @param isThrow
* @param msg 异常信息
* @author sr on 2019-10-14
*/
public static void throwBusinessException(boolean isThrow, String msg) {
if (isThrow) {
throw new BusinessException(msg);
}
}
/**
* 根据判断抛异常
* @param isThrow
* @param errorMsg 异常信息
* @param logMsg 日志信息(info级)
* @author sr on 2019-12-18
*/
public static void throwBusinessException(boolean isThrow, String errorMsg, String logMsg) {
if (isThrow) {
log.info(logMsg);
throw new BusinessException(errorMsg);
}
}
}