Skip to content

Commit 0c7e668

Browse files
cherrydevmichaelbull
authored andcommitted
Collapse multiple catch blocks for Graalvm
1 parent 4346355 commit 0c7e668

File tree

1 file changed

+4
-3
lines changed
  • src/main/kotlin/com/github/michaelbull/retry

1 file changed

+4
-3
lines changed

src/main/kotlin/com/github/michaelbull/retry/Retry.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ suspend fun <T> retry(
5050
while (true) {
5151
try {
5252
return@withContext block()
53-
} catch (ex: CancellationException) {
54-
/* avoid swallowing CancellationExceptions */
55-
throw ex
5653
} catch (t: Throwable) {
54+
/* avoid swallowing CancellationExceptions */
55+
if (t is CancellationException) {
56+
throw t
57+
}
5758
val instruction = RetryFailure(t).policy()
5859

5960
val status = coroutineContext.retryStatus

0 commit comments

Comments
 (0)