summaryrefslogblamecommitdiff
path: root/test/files/run/try-catch-unify.scala
blob: 151e549e5fdf1890f1a9d283943ee60db149c6d4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                             
                                                 
     
                                                  

   
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: Throwable => println(t.getMessage)
    }
    println(nonFatalCatch withTry ("Hi".toDouble))
  }
}