package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.WhiteList;
import com.yida.data.system.feign.RemoteWhiteListService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteWhiteListService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteWhiteListServiceFallback implements FallbackFactory<RemoteWhiteListService> {

    @Override
    public RemoteWhiteListService create(Throwable throwable) {
        log.error("RemoteWhiteListService fallback reason:{}", throwable.getMessage());

        return new RemoteWhiteListService() {
            @Override
            public ResultBean<WhiteList> getWhiteList(String functionName) {
                return null;
            }
        };
    }
}
