Skip to content

Commit afb925f

Browse files
Dmitry Glushkovkptfh
authored andcommitted
WebReactiveFeign.Builder: use 'errorMapper' from configuration
1 parent 2650396 commit afb925f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

feign-reactor-webclient/src/main/java/reactivefeign/webclient/WebReactiveFeign.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import reactivefeign.client.ReadTimeoutException;
2323
import reactor.netty.http.client.HttpClient;
2424

25+
import java.util.Objects;
2526
import java.util.function.BiFunction;
2627

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

7980
@Override
8081
public BiFunction<ReactiveHttpRequest, Throwable, Throwable> errorMapper(){
81-
return (request, throwable) -> {
82-
if(throwable instanceof WebClientRequestException
83-
&& throwable.getCause() instanceof io.netty.handler.timeout.ReadTimeoutException){
82+
return Objects.requireNonNullElseGet(this.errorMapper, () -> (request, throwable) -> {
83+
if (throwable instanceof WebClientRequestException
84+
&& throwable.getCause() instanceof io.netty.handler.timeout.ReadTimeoutException) {
8485
return new ReadTimeoutException(throwable, request);
8586
}
8687
return null;
87-
};
88+
});
8889
}
8990
}
9091

0 commit comments

Comments
 (0)