#4121 deprecated IO.onError(f: Throwable => IO[Unit]) and added def onError(pf: PartialFunction[Throwable, IO[Unit]]) to be used instead.
Normally total functions can be passed in place of a partial function and Scala will automatically create a partial function wrapper for it. In other words, we should be able to call the partial function variant of onError with a total function. Here's a scastie snippet showing that expected behaviour of onError with Resource.
Unfortunately, when calling IO.onError with a total function in CE 3.6.0, there is deprecation warning. This is inconsistent with earlier versions or the behaviour of ApplicativeError.onError.
It'd be great to make IO.onError not generate a deprecation warning when passed a total function.
Proposed fix from discord is to mark the deprecated version of onError as package private.
#4121 deprecated
IO.onError(f: Throwable => IO[Unit])and addeddef onError(pf: PartialFunction[Throwable, IO[Unit]])to be used instead.Normally total functions can be passed in place of a partial function and Scala will automatically create a partial function wrapper for it. In other words, we should be able to call the partial function variant of
onErrorwith a total function. Here's a scastie snippet showing that expected behaviour ofonErrorwithResource.Unfortunately, when calling
IO.onErrorwith a total function in CE 3.6.0, there is deprecation warning. This is inconsistent with earlier versions or the behaviour ofApplicativeError.onError.It'd be great to make
IO.onErrornot generate a deprecation warning when passed a total function.Proposed fix from discord is to mark the deprecated version of
onErroras package private.