package cn.qinys.platform.base.exceptions;

import cn.qinys.platform.base.response.ResultCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * Description:
 * @author tanlie
 * Date: 2022-10-12 16:28
 */

@EqualsAndHashCode(callSuper = true)
@Data
public class BizException extends RuntimeException {

    private Integer code;

    private String msg;

    private Object data;

    public BizException(Integer code){
        this.code = code;
    }


    public BizException(String msg){
        this.msg = msg;
    }


    public BizException(Integer code, String msg){
        this.msg = msg;
        this.code = code;
    }

    public BizException(ResultCodeEnum codeEnum){
        this.msg = codeEnum.getDesc();
        this.code = codeEnum.getCode();
    }

    public BizException(ResultCodeEnum codeEnum,String msg){
        this.msg = msg;
        this.code = codeEnum.getCode();
    }


}
