package thyyxxk.webserver.config.exception;


import lombok.Getter;

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

    public BizException() {
        super();
    }

    public BizException(ExceptionEnumInterface errorEnum) {
        super(errorEnum.getMessage());
        this.code = errorEnum.getCode();
        this.msg = errorEnum.getMessage();
    }

    public BizException(String message) {
        super(new Throwable(message));
        this.code = ExceptionEnum.INTERNAL_SERVER_ERROR.getCode();
        this.msg = message;
    }

    public BizException(ExceptionEnumInterface errorEnum, String message) {
        super(message);
        this.code = errorEnum.getCode();
        this.msg = message;
    }

    public BizException(ExceptionEnumInterface errorEnum, Throwable cause) {
        super(errorEnum.getMessage(), cause);
        this.code = errorEnum.getCode();
        this.msg = errorEnum.getMessage();
    }

}
