package top.imwork.commons.redis.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Copyright (C), 2015-2021
 * FileName: RedisException
 * Author:   jiangxiaowei
 * Date:     2021/6/20 22:10
 * Description: Redis异常类
 * History:
 */
public class RedisException extends RuntimeException {
    private static final long serialVersionUID = -1465322317086082432L;
    static final Logger logger = LoggerFactory.getLogger(RedisException.class);

    public RedisException(Throwable e) {
        super(e);
    }

    public RedisException(Throwable e, boolean isLog) {
        super(e);
        if (isLog) {
            logger.error(e.getMessage());
        }
    }

    public RedisException(String message) {
        super(message);
    }

    public RedisException(String message, boolean isLog) {
        super(message);
        if (isLog) {
            logger.error(message);
        }
    }

    public RedisException(String message, Throwable e) {
        super(message, e);
    }

    public RedisException(String message, Throwable e, boolean isLog) {
        super(message, e);
        if (isLog) {
            logger.error(message, e);
        }
    }
}
