The idiomatic method of dealing with Option goals is to use concepts and call getOrElse .
val a = for { val temp <- f(param) val result <- Some(g(temp)) } yield result getOrElse <Default Here>
There is no way to do this either by default or when an exception occurs if you are going to categorically unzip Option , since f can return None and g cannot accept this.
source share