package com.kym.common.exception;

import com.kym.common.constant.IResponseCode;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author skyline
 * @description 自定义异常
 * @date 2023-07-02 15:08
 */
@AllArgsConstructor
@Getter
public class BaseException extends RuntimeException {
    Integer code;
    String message;

    BaseException(IResponseCode responseEnum) {
        this.code = responseEnum.getCode();
        this.message = responseEnum.getMessage();
    }

    BaseException(IResponseCode responseEnum, Object[] args, String message) {
        this.code = responseEnum.getCode();
        this.message = message;
        // TODO: 2023-07-04 args处理
    }

    BaseException(IResponseCode responseEnum, Object[] args, String message, Throwable cause) {
        this.code = responseEnum.getCode();
        this.message = message;
        // TODO: 2023-07-04 args cause 处理 
    }

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


}
