package com.fdkankan.ucenter.exception;

import com.fdkankan.ucenter.common.constants.ResultCode;
import com.fdkankan.ucenter.common.constants.ResultCodeMsg;
import lombok.Data;

/**
 * 自定义业务异常类
 */
@Data
public class BusinessException extends RuntimeException {
    private int code;
    private String message;

    public BusinessException(Integer code, String msg){
        this.code = code;
        this.message = msg;
    }
    public BusinessException(String msg){
        this.code = -1;
        this.message = msg;
    }

    public BusinessException(ResultCode errorCode) {
        this.code = errorCode.code();
        this.message = errorCode.message();
    }
}
