I am trying to catch different types of exceptions but I am stuck on an error. I imported scala.util.control.Exception._
try {
isAuthenticatedJson(f)
}catch {
//object RuntimeException is not a value
case RuntimeException => {}
//object Exception is not a value
case Exception => {}
}
What am I missing?
Try this (note the underscore):
try {
isAuthenticatedJson(f)
} catch {
case _: RuntimeException => {}
case _: Exception => {}
}
This is a "typed pattern". See http://www.scala-lang.org/node/120.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With