Use try and catch, where the catch clause is a pattern match.
try
catch
try { // ... } catch { case ioe: IOException => ... // more specific cases first ! case e: Exception => ... }