SmaPlatBusinessException.java 728 Bytes
package cn.com.glsx.common.exception;

import com.glsx.plat.exception.BusinessException;
import lombok.Data;

/**
 * <p>Description: 车家智能异常类
 * <p>Project: chejia-smart
 *
 * @author wbh
 * @Date 2021-03-16
 */
@Data
public class SmaPlatBusinessException extends RuntimeException{

    private int code;

    private String message;

    public SmaPlatBusinessException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static SmaPlatBusinessException create(ResultEnum resultEnum, Object... args) {
        String message = String.format(resultEnum.getMessage(), args);
        return new SmaPlatBusinessException(resultEnum.getErrorcode(), message);
    }
}