Skip to content

Instantly share code, notes, and snippets.

@gustavofranke
Created February 22, 2017 13:59
Show Gist options
  • Save gustavofranke/9bebdf129facf5bdc7b363345e7b3b18 to your computer and use it in GitHub Desktop.
Save gustavofranke/9bebdf129facf5bdc7b363345e7b3b18 to your computer and use it in GitHub Desktop.
scala try type
import scala.util.Try
val a = Try(5 / 0)
a.isSuccess
a.isFailure
a.toOption
a.failed
a.orElse(Try(1))
a.recoverWith { case _ ⇒ Try(1) }
a.getOrElse("boom")
a.get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment