blob: 0d819ab957437977b53f5f4f6217718cc2e289c5 (
plain) (
tree)
|
|
import util._
import control.Exception._
object Test {
def main(args: Array[String]): Unit = {
println(catching(classOf[NumberFormatException]) withTry ("Hi".toDouble))
println(catching(classOf[NumberFormatException]) withTry ("5".toDouble))
try {
catching(classOf[NumberFormatException]) withTry (sys.error("O NOES"))
} catch {
case t => println(t.getMessage)
}
}
}
|