package com.kym.common.exception;

import com.kym.common.Assert;
import com.kym.common.constant.IResponseCode;

import java.text.MessageFormat;

/**
 * @author skyline
 * @description 业务异常断言
 * @date 2023-07-08 10:30
 */
public interface BusinessExceptionAssert extends IResponseCode, Assert {
    @Override
    default BaseException baseException(Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg);
    }

    @Override
    default BaseException baseException(Throwable t, Object... args) {
        String msg = MessageFormat.format(this.getMessage(), args);
        return new BusinessException(this, args, msg, t);
    }
}
