This calls for a utility method, you could add it here: `src/compiler/scala/tools/nsc/util/package.scala`.

```scala
def wrapUncheckedException(t: Throwable, wrap: Throwable => Throwable = new RuntimeException(_)): Throwable = t match {
  case re: RuntimeException => re
  case e: Exception => wrap(e)
  case t => t
}
```