package com.mosty.common.base.exception;

import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 *  业务异常处理器
 * @author kevin
 * @date 2022/1/22 4:38 PM
 * @since 1.0.0
 */
@Data
@SuppressWarnings("unused")
@EqualsAndHashCode(callSuper = true)
public class BusinessException extends RuntimeException {

    /** 异常编码 */
    private Integer code;

    /**
     * 数据
     */
    private Object data;

    public BusinessException(String message) {
        super(message);
    }

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

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

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

    public BusinessException(String message, Throwable arg) {
        super(message, arg);
    }

}