package com.casic.missiles.exception;

import com.casic.missiles.enums.BusinessExceptionEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 业务异常
 * @Author: wangpeng
 * @Date: 2022/11/24 17:52
 */
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    @Getter
    @Setter
    private Integer code;
    @Getter
    @Setter
    private String message;

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

    public BusinessException(BusinessExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
    }

}
