package thyyxxk.webserver.config.exception;

/**
 * @author dj
 */
public class BizException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    protected ExceptionEnum errorEnum;

    public BizException() {
        super();
    }

    public BizException(ExceptionEnum errorEnum) {
        super(errorEnum.getMessage());
        this.errorEnum = errorEnum;
    }

    public BizException(ExceptionEnum errorEnum, String message) {
        super(message);
        errorEnum.setMessage(message);
        this.errorEnum = errorEnum;
    }

    public BizException(ExceptionEnum errorEnum, Throwable cause) {
        super(errorEnum.getMessage(), cause);
        this.errorEnum = errorEnum;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

    public ExceptionEnum getErrorEnum() {
        return this.errorEnum;
    }
}
