Skip to content

Commit

Permalink
Merge pull request #3615 from djspiewak/bug/continuing-failure
Browse files Browse the repository at this point in the history
Fixed issue in which failing `uncancelable` would remain masked for one stage
  • Loading branch information
armanbilge authored May 12, 2023
2 parents 9236fb4 + cb2b179 commit a4d76cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/cats/effect/IOFiber.scala
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ private final class IOFiber[A](
try cur.body(poll)
catch {
case t if NonFatal(t) =>
failed(t, 0)
IO.raiseError(t)
case t: Throwable =>
onFatalFailure(t)
}
Expand Down
5 changes: 5 additions & 0 deletions tests/shared/src/test/scala/cats/effect/IOSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,11 @@ class IOSpec extends BaseSpec with Discipline with IOPlatformSpecification {
"catch stray exceptions in uncancelable" in ticked { implicit ticker =>
IO.uncancelable[Unit](_ => throw new RuntimeException).voidError must completeAs(())
}

"unmask following stray exceptions in uncancelable" in ticked { implicit ticker =>
IO.uncancelable[Unit](_ => throw new RuntimeException)
.handleErrorWith(_ => IO.canceled *> IO.never) must selfCancel
}
}

"finalization" should {
Expand Down

0 comments on commit a4d76cd

Please sign in to comment.