jweinst1
5/18/2017 - 5:16 AM

how to implement custom throwable in scala

how to implement custom throwable in scala

//scala custom throwable


case class Fooxcp(val message:String) extends Throwable;
                      
                      
try {
    throw Fooxcp("hello")
} catch {
    case c: Fooxcp =>
          println(c.message)
          //hello
}