@@ -106,7 +106,7 @@ public <P extends Policy<R>> FailsafeExecutor<R> compose(P innerPolicy) {
106106 *
107107 * @throws NullPointerException if the {@code supplier} is null
108108 * @throws FailsafeException if the {@code supplier} fails with a checked Exception. {@link
109- * FailsafeException#getCause()} can be used to learn the checked exception that caused the failure.
109+ * FailsafeException#getCause()} can be used to learn the underlying checked exception
110110 * @throws TimeoutExceededException if the execution fails because a {@link Timeout} is exceeded.
111111 * @throws CircuitBreakerOpenException if the execution fails because a {@link CircuitBreaker} is open.
112112 * @throws RateLimitExceededException if the execution fails because a {@link RateLimiter} is exceeded.
@@ -120,7 +120,7 @@ public <T extends R> T get(CheckedSupplier<T> supplier) {
120120 *
121121 * @throws NullPointerException if the {@code supplier} is null
122122 * @throws FailsafeException if the {@code supplier} fails with a checked Exception. {@link
123- * FailsafeException#getCause()} can be used to learn the checked exception that caused the failure.
123+ * FailsafeException#getCause()} can be used to learn the underlying checked exception
124124 * @throws TimeoutExceededException if the execution fails because a {@link Timeout} is exceeded.
125125 * @throws CircuitBreakerOpenException if the execution fails because a {@link CircuitBreaker} is open.
126126 * @throws RateLimitExceededException if the execution fails because a {@link RateLimiter} is exceeded.
@@ -173,8 +173,8 @@ public <T extends R> CompletableFuture<T> getAsync(ContextualSupplier<T, T> supp
173173 * Executes the {@code runnable} asynchronously until a successful result is recorded or the configured policies are
174174 * exceeded. Executions must be recorded via one of the {@code AsyncExecution.record} methods which will trigger
175175 * failure handling, if needed, by the configured policies, else the resulting {@link CompletableFuture} will be
176- * completed. Any exception that is thrown from the {@code runnable} will automatically be recorded via {@code
177- * AsyncExecution.recordFailure }.
176+ * completed. Any exception that is thrown from the {@code runnable} will automatically be recorded via {@link
177+ * AsyncExecution#recordException(Throwable) }.
178178 * </p>
179179 * <ul>
180180 * <li>If the execution fails because a {@link Timeout} is exceeded, the resulting future is completed exceptionally
@@ -241,7 +241,7 @@ public <T extends R> CompletableFuture<T> getStageAsync(
241241 *
242242 * @throws NullPointerException if the {@code runnable} is null
243243 * @throws FailsafeException if the {@code runnable} fails with a checked Exception. {@link
244- * FailsafeException#getCause()} can be used to learn the checked exception that caused the failure.
244+ * FailsafeException#getCause()} can be used to learn the underlying checked exception
245245 * @throws TimeoutExceededException if the execution fails because a {@link Timeout} is exceeded.
246246 * @throws CircuitBreakerOpenException if the execution fails because a {@link CircuitBreaker} is open.
247247 * @throws RateLimitExceededException if the execution fails because a {@link RateLimiter} is exceeded.
@@ -255,7 +255,7 @@ public void run(CheckedRunnable runnable) {
255255 *
256256 * @throws NullPointerException if the {@code runnable} is null
257257 * @throws FailsafeException if the {@code runnable} fails with a checked Exception. {@link
258- * FailsafeException#getCause()} can be used to learn the checked exception that caused the failure.
258+ * FailsafeException#getCause()} can be used to learn the underlying checked exception
259259 * @throws TimeoutExceededException if the execution fails because a {@link Timeout} is exceeded.
260260 * @throws CircuitBreakerOpenException if the execution fails because a {@link CircuitBreaker} is open.
261261 * @throws RateLimitExceededException if the execution fails because a {@link RateLimiter} is exceeded.
@@ -306,8 +306,8 @@ public CompletableFuture<Void> runAsync(ContextualRunnable<Void> runnable) {
306306 * Executes the {@code runnable} asynchronously until a successful result is recorded or the configured policies are
307307 * exceeded. Executions must be recorded via one of the {@code AsyncExecution.record} methods which will trigger
308308 * failure handling, if needed, by the configured policies, else the resulting {@link CompletableFuture} will be
309- * completed. Any exception that is thrown from the {@code runnable} will automatically be recorded via {@code
310- * AsyncExecution.recordFailure }.
309+ * completed. Any exception that is thrown from the {@code runnable} will automatically be recorded via {@link
310+ * AsyncExecution#recordException(Throwable) }.
311311 * </p>
312312 * <ul>
313313 * <li>If the execution fails because a {@link Timeout} is exceeded, the resulting future is completed exceptionally
@@ -436,13 +436,13 @@ public FailsafeExecutor<R> with(Scheduler scheduler) {
436436 private <T > T call (ContextualSupplier <T , T > innerSupplier ) {
437437 SyncExecutionImpl <T > execution = new SyncExecutionImpl (this , scheduler , Functions .get (innerSupplier , executor ));
438438 ExecutionResult <T > result = execution .executeSync ();
439- Throwable failure = result .getFailure ();
440- if (failure != null ) {
441- if (failure instanceof RuntimeException )
442- throw (RuntimeException ) failure ;
443- if (failure instanceof Error )
444- throw (Error ) failure ;
445- throw new FailsafeException (failure );
439+ Throwable exception = result .getException ();
440+ if (exception != null ) {
441+ if (exception instanceof RuntimeException )
442+ throw (RuntimeException ) exception ;
443+ if (exception instanceof Error )
444+ throw (Error ) exception ;
445+ throw new FailsafeException (exception );
446446 }
447447 return result .getResult ();
448448 }
0 commit comments