package com.gz.core.exception;

import com.gz.core.response.CustomResponsInterface;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 业务异常
 * @author LiuchangLan
 * @date 2020/6/27 22:23
 */
@RequiredArgsConstructor
@Getter
public class BusinessException extends RuntimeException{
    private Integer errorCode;
    private String errorMsg;

    /**
     * @description 枚举抛出异常
     * @author LiuChangLan
     * @since 2021/1/26 22:32
     */
    public BusinessException(CustomResponsInterface customResponseInterface){
        super("业务异常 - " + customResponseInterface.getMsg());
        this.errorCode = customResponseInterface.getCode();
        this.errorMsg =customResponseInterface.getMsg();
    }

    /**
     * @description 自定义抛出异常
     * @author LiuChangLan
     * @since 2021/1/26 22:32
     */
    public BusinessException(Integer errorCode, String errorMsg){
        super("业务异常 - " + errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }
}
