You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code fails with java.lang.Error: Defect in zio.ZEnvironment: Could not find ErrorExample::Context inside ZEnvironment(Any -> Context(42))
import tofu.WithRun
import tofu.zioInstances.implicits.zioTofuWithRunImplicit
import zio._
object ZIOWithRunError extends ZIOAppDefault {
case class Context(x: Int)
val app: RIO[Context, Unit] = ZIO.service[Context].flatMap(Console.printLine(_))
override def run: ZIO[Any with ZIOAppArgs with Scope, Any, Any] =
WithRun[RIO[Context, *], Task, Context].runContext(app)(Context(42))
}
Based on the error message, it seems like Context's tag is not used to build ZEnvironment when using WithRun instance, resulting in ZIO being unable to find Context instance in the environment.
The text was updated successfully, but these errors were encountered:
The following code fails with
java.lang.Error: Defect in zio.ZEnvironment: Could not find ErrorExample::Context inside ZEnvironment(Any -> Context(42))
Based on the error message, it seems like
Context
's tag is not used to buildZEnvironment
when usingWithRun
instance, resulting in ZIO being unable to findContext
instance in the environment.The text was updated successfully, but these errors were encountered: