package com.persagy.dmp.auth.client;

import com.persagy.dmp.common.model.response.CommonResult;
import com.persagy.dmp.common.utils.ResultHelper;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * pass-account应用
 * @author : lijie
 * Update By 2022/1/10 19:21
 */
@Slf4j
public class PaasAccountFallbackFactory implements FallbackFactory<PaasAccountClient> {

    /**
     * 调用失败,返回
     */
    @Override
    public PaasAccountClient create(Throwable throwable) {
        return new PaasAccountClient() {
            @Override
            public CommonResult<String> accountLogin(Object param) {
                return ResultHelper.failure("调用pass-account失败:" + throwable.getMessage());
            }

            @Override
            public CommonResult<String> accountTokenRefresh(Object param) {
                return ResultHelper.failure("调用pass-account失败:" + throwable.getMessage());
            }
        };
    }

}
