X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Ffacebook%2Ferrors%2FGraphApiExchangeFilterFunction.java;h=53bdd0b48e73727f53f955d94c5e9ac9a843a1b2;hb=6fcd07c06f7cbc8f07b8c1ca01bf83e33467d4af;hp=0b583f4e394869fa9687abd8427d8ca1f315d58e;hpb=cadda60f8110dc90e43b5c52b649ec5657be2953;p=facebook-errors diff --git a/src/main/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunction.java b/src/main/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunction.java index 0b583f4..53bdd0b 100644 --- a/src/main/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunction.java +++ b/src/main/java/de/juplo/facebook/errors/GraphApiExchangeFilterFunction.java @@ -1,6 +1,8 @@ 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; @@ -15,6 +17,9 @@ import reactor.core.publisher.Mono; */ public class GraphApiExchangeFilterFunction implements ExchangeFilterFunction { + private static final Logger LOG = + LoggerFactory.getLogger(GraphApiExchangeFilterFunction.class); + public static GraphApiExchangeFilterFunction INSTANCE = new GraphApiExchangeFilterFunction(); @@ -23,14 +28,15 @@ public class GraphApiExchangeFilterFunction implements ExchangeFilterFunction public Mono 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); + }); } }