In order to catch exception, I can use Try recover get:
Try(op) recover {
case e: FooException => log; default
} get
Edit: or fold as pointed out in the comment for Scala 2.12+
or I can use Try match:
Try(op) match {
case Success(v) => v
case Failure(e: FooException) => log; default
case Failure(e)=> throw e
}
What is the difference between these two? Which one is more idiomatic? What is the reasoning? Is there any performance implication?