Skip to content

Instantly share code, notes, and snippets.

@eamelink
Created February 10, 2015 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eamelink/9122bf57714e6ac22f2b to your computer and use it in GitHub Desktop.
Save eamelink/9122bf57714e6ac22f2b to your computer and use it in GitHub Desktop.
scala> import scala.util.Try
scala> object Borked { sys.error("Boom!") }
defined object Borked
scala> Try(Borked)
java.lang.RuntimeException: Boom!
at scala.sys.package$.error(package.scala:27)
... 38 elided
scala> try { Borked } catch { case e => println(e) }
<console>:10: warning: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning.
try { Borked } catch { case e => println(e) }
^
java.lang.NoClassDefFoundError: Could not initialize class $line3.$read$$iw$$iw$Borked$
res2: Any = ()
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment