Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. val tFail: Try[String] = Try(throw new Exception("I failed!"))
  2. // tFail: scala.util.Try[String] = Failure(java.lang.Exception: I failed!)
  3. val tThrow = tFail.failed
  4. // tThrow: scala.util.Try[Throwable] = Success(java.lang.Exception: I failed!)
  5. val tSuccess = Try("Everything okay!")
  6. // tSuccess: scala.util.Try[String] = Success(Everything okay!)
  7. val tThrow2 = tSuccess.failed
  8. // tThrow2: scala.util.Try[Throwable] = Failure(java.lang.UnsupportedOperationException: Success.failed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement