Skip to content

Commit

Permalink
WebReactiveFeign.Builder: use 'errorMapper' from configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Glushkov authored and kptfh committed Sep 4, 2024
1 parent 2650396 commit afb925f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import reactivefeign.client.ReadTimeoutException;
import reactor.netty.http.client.HttpClient;

import java.util.Objects;
import java.util.function.BiFunction;

import static reactivefeign.webclient.NettyClientHttpConnectorBuilder.buildNettyClientHttpConnector;
Expand Down Expand Up @@ -78,13 +79,13 @@ protected ClientHttpConnector clientConnector() {

@Override
public BiFunction<ReactiveHttpRequest, Throwable, Throwable> errorMapper(){
return (request, throwable) -> {
if(throwable instanceof WebClientRequestException
&& throwable.getCause() instanceof io.netty.handler.timeout.ReadTimeoutException){
return Objects.requireNonNullElseGet(this.errorMapper, () -> (request, throwable) -> {
if (throwable instanceof WebClientRequestException
&& throwable.getCause() instanceof io.netty.handler.timeout.ReadTimeoutException) {
return new ReadTimeoutException(throwable, request);
}
return null;
};
});
}
}

Expand Down

0 comments on commit afb925f

Please sign in to comment.