package com.lanyuanxiaoyao.service.sync.utils;

import org.slf4j.Logger;

/**
 * 处理异常抛出和打印
 *
 * @author lanyuanxiaoyao
 * @date 2024-10-22
 */
public class ExceptionUtils {
    public static <T> T throwAndPrint(Logger logger, String content) {
        logger.error(content);
        throw new RuntimeException(content);
    }

    public static <T> T throwAndPrint(Logger logger, Throwable throwable) {
        logger.error(throwable.getMessage(), throwable);
        throw new RuntimeException(throwable);
    }

    public static <T> T throwAndPrint(Logger logger, String content, Throwable throwable) {
        logger.error(content, throwable);
        throw new RuntimeException(content, throwable);
    }
}
