Exception - scala-lang.org
www.scala-lang.org › util › controlobject Exception Classes representing the components of exception handling. Each class is independently composable. This class differs from scala.util.Try in that it focuses on composing exception handlers rather than composing behavior. All behavior should be composed first and fed to a Catch object using one of the opt, either or withTry methods.
Custom Exception in scala - Stack Overflow
stackoverflow.com › questions › 38243530Apr 12, 2018 · case class CustomException(message: String) extends Exception(message) with MyException { override val details: JsValue = Json.obj("message" -> message, "etc" -> "Anything else") } Now, the whole point of using Scala is walking towards a more functional programming style, it will make your app more concurrent, so if you need to use your new custom exception, you might want to try something like this: