package com.ylcm.sys.exception;

import com.ylcm.sys.controller.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author: XPF
 * @Description:
 * @Date: Created in 13:56 2018/4/18
 * @Modified by:
 */
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = 9062251910636681333L;

    private Logger logger = LoggerFactory.getLogger(BaseController.class);

    private String msg; //自定义返回消息

    public BaseException() {
        super();
    }

    public BaseException(String message) {
        super(message);
        this.msg = message;
        logger.error(message);
    }

    public BaseException(String beanName,String method ,String exceptionMsg){
        this.msg = beanName+"#"+method+" 产生异常: ["+exceptionMsg+"]";
        logger.error(beanName+"#"+method+" 产生异常: ["+exceptionMsg+"]");
    }

    public BaseException(String message, Throwable cause) {
        super(message, cause);
        this.msg = message;
    }

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

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
