org.zalando.riptide.GuardedRequestExecution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riptide-core Show documentation
Show all versions of riptide-core Show documentation
Client side response routing
package org.zalando.riptide;
import lombok.AllArgsConstructor;
import org.springframework.http.client.ClientHttpResponse;
import java.util.concurrent.CompletableFuture;
import static org.zalando.riptide.CompletableFutures.exceptionallyCompletedFuture;
@AllArgsConstructor
final class GuardedRequestExecution implements RequestExecution {
private final RequestExecution execution;
@Override
public CompletableFuture execute(final RequestArguments arguments) {
try {
return execution.execute(arguments);
} catch (final Exception e) {
return exceptionallyCompletedFuture(e);
}
}
}