Files
senmesh-zc/src/main/java/com/senmesh/common/exception/util/ExceptionUtils.java
ran.shang ee95dfa2c2 init
2025-12-29 16:06:48 +08:00

49 lines
1.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.senmesh.common.exception.util;
import com.senmesh.common.exception.BusinessException;
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);
}
}
}