package de.juplo.facebook.errors;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.reactive.function.client.ClientRequest;
import org.springframework.web.reactive.function.client.ClientResponse;
*/
public class GraphApiExchangeFilterFunction implements ExchangeFilterFunction
{
+ private static final Logger LOG =
+ LoggerFactory.getLogger(GraphApiExchangeFilterFunction.class);
+
public static GraphApiExchangeFilterFunction INSTANCE =
new GraphApiExchangeFilterFunction();
public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next)
{
return
- next
- .exchange(request)
- .flatMap(response ->
- {
- return
- HttpStatus.Series.CLIENT_ERROR.equals(response.statusCode().series())
- ? Mono.error(GraphApiException.create(response))
- : Mono.just(response);
- });
+ next
+ .exchange(request)
+ .doOnError(e -> LOG.debug("ERROR: {}", e))
+ .flatMap(response ->
+ {
+ return
+ HttpStatus.Series.CLIENT_ERROR.equals(response.statusCode().series())
+ ? Mono.error(GraphApiException.create(response))
+ : Mono.just(response);
+ });
}
}