Skip to content

Commit

Permalink
Replace usage of the old onError with the new one
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Aug 20, 2024
1 parent 932fa7d commit f9ae95c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/cats/effect/IO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
IO.executionContext.flatMap(ec => IO(ec.reportFailure(t)))
}

poll(this).onCancel(finalizer).onError(_ => handled).flatTap(_ => finalizer)
poll(this).onCancel(finalizer).onError { case _ => handled }.flatTap(_ => finalizer)
}

/**
Expand All @@ -519,7 +519,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
def guaranteeCase(finalizer: OutcomeIO[A @uncheckedVariance] => IO[Unit]): IO[A] =
IO.uncancelable { poll =>
val finalized = poll(this).onCancel(finalizer(Outcome.canceled))
val handled = finalized.onError { e =>
val handled = finalized.onError { case e =>
finalizer(Outcome.errored(e)).handleErrorWith { t =>
IO.executionContext.flatMap(ec => IO(ec.reportFailure(t)))
}
Expand Down

0 comments on commit f9ae95c

Please sign in to comment.