测试

X

import feign.Response;
import feign.RetryableException;
import feign.codec.ErrorDecoder;

public class CustomErrorDecoder implements ErrorDecoder {

    @Override
    public Exception decode(String methodKey, Response response) {
        if (response.status() == 429) {
            return new RetryableException(
                    "Too many requests",
                    null,
                    response.request().httpMethod(),
                    null,
                    response.request());
        }

        return new RuntimeException("Unknown error");
    }
}
posted @ 2023-04-19 17:20  小羊摩多摩多  阅读(19)  评论(0)    收藏  举报