Reproduction script (scala-cli):
//> using lib "org.typelevel::cats-effect:3.3.13"
import cats.effect.*
object Main extends IOApp.Simple:
def run =
Resource
.eval(IO.raiseError(new Exception("Boom")))
.race(Resource.never)
.attempt
.use(_ =>
IO.println("Done")
)
Running scala-cli run main.scala gives the following output:
java.lang.Exception: Boom
at Main$.run(main.scala:9)
at run$ @ Main$.run(main.scala:5)
Done
where exception stacktrace comes from standard error.
Reproduction script (scala-cli):
Running
scala-cli run main.scalagives the following output:where exception stacktrace comes from standard error.