Skip to content

Commit

Permalink
Unwrap Failsafe target exception
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Nov 30, 2024
1 parent 2fd351d commit 984560e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/groovy/io/seqera/wave/util/Retryable.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import java.util.function.Consumer
import java.util.function.Predicate

import dev.failsafe.Failsafe
import dev.failsafe.FailsafeException
import dev.failsafe.RetryPolicy
import dev.failsafe.RetryPolicyBuilder
import dev.failsafe.event.EventListener
Expand Down Expand Up @@ -137,7 +138,11 @@ class Retryable<R> {

R apply(CheckedSupplier<R> action) {
final policy = retryPolicy()
return Failsafe.with(policy).get(action)
try {
return Failsafe.with(policy).get(action)
} catch (FailsafeException e) {
throw e.cause
}
}

static <T> Retryable<T> of(Config config) {
Expand Down

0 comments on commit 984560e

Please sign in to comment.