package com.kexue.skills.exception;

public class BizException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private long errorCode;
    private String errorMessage;

    public BizException() {
        super();
    }

    public BizException(String errorMessage) {
        super(errorMessage);
        this.errorCode = 500;
        this.errorMessage = errorMessage;
    }

    public BizException(long errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public BizException(int errorCode, String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

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

    public long getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    @Override
    public String toString() {
        return "BizException{" +
                "errorCode=" + errorCode +
                ", errorMessage='" + errorMessage + '\'' +
                '}';
    }
}