I define some case classes based on Exception
with identical behavior (source)
case class Foo(msg: String) extends Exception {
override def toString: String = scala.runtime.ScalaRunTime._toString(this)
}
case class Bar(msg: String) extends Exception {
override def toString: String = scala.runtime.ScalaRunTime._toString(this)
}
case class Boo(msg: String) extends Exception {
override def toString: String = scala.runtime.ScalaRunTime._toString(this)
}
All these new exceptions repeat same code. I want to rid of redundant code duplication. I unsuccessfully tried to use interim common base class and traits. Please, help me remove excess code duplication.