package com.izouma.jmrh.exception;

import java.util.function.Supplier;

public class BusinessException extends RuntimeException implements Supplier<BusinessException> {
    private static final long serialVersionUID = 3779880207424189309L;

    private Integer code = -1;
    private String  error;

    public BusinessException(String error) {
        super();
        this.error = error;
    }

    public BusinessException(String error, String message) {
        super(message);
        this.error = error;
    }

    public BusinessException(String error, String message, Integer code) {
        super(message);
        this.code = code;
        this.error = error;
    }

    public BusinessException(String error, int code) {
        super();
        this.error = error;
        this.code = code;
    }

    @Override
    public BusinessException get() {
        return this;
    }

    public Integer getCode() {
        return code;
    }

    public String getError() {
        return error;
    }
}
