Skip to main content
Version: 1.0.18

Exit

An Exit[E, A] value describes how fibers end life. It has two possible values:

  • Exit.Success contain a success value of type A.
  • Exit.Failure contains a failure Cause of type E.

We can call run on our effect to determine the Success or Failure of our fiber:

import zio._
import zio.console._
for {
successExit <- ZIO.succeed(1).run
_ <- successExit match {
case Exit.Success(value) =>
putStrLn(s"exited with success value: ${value}")
case Exit.Failure(cause) =>
putStrLn(s"exited with failure state: $cause")
}
} yield ()

ZIO Chat

Hello! ๐Ÿ˜Š I'm your ZIO Chat Bot, designed to be your go-to resource for all things ZIO! Whether you're new to this powerful functional effect system or a seasoned pro, I'm here to assist you. ZIO empowers you to build concurrent and resilient applications in Scala, offering referential transparency, composable data types, type-safety, and more. So, go ahead and ask me anything about ZIO โ€“ I'm here to provide the answers you need! ๐Ÿค–