All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.doudou.common.tool.exception.CustomException Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
package top.doudou.common.tool.exception;


import lombok.extern.slf4j.Slf4j;
import top.doudou.common.tool.utils.ChineseCharacterUtil;

/**
 * 自定义异常
 * @author 傻男人<[email protected]>
 * @create 2018-09-18-14:56
 */
@Slf4j
public class CustomException extends RuntimeException {
    private static final long serialVersionUID = 100000L;

    public CustomException(String message){
        super(message(message));
    }

    public CustomException(String message, Object... parameters){
        super(message(message,parameters));
    }

    public CustomException(Throwable cause) {
        super(cause);
    }

    public static String message(String message){
        if(!ChineseCharacterUtil.isContainChinese(message)){
            return "系统内部错误";
        }
        return message;
    }

    public static String message(String message,Object... parameters){
        return StringCommonUtils.strReplace(message,parameters);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy