All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dotty.tools.dotc.reporting.ThrowingReporter.scala Maven / Gradle / Ivy

There is a newer version: 3.6.4-RC1-bin-20241220-0bfa1af-NIGHTLY
Show newest version
package dotty.tools
package dotc
package reporting

import core.Contexts.*
import Diagnostic.Error

/**
 * This class implements a Reporter that throws all errors as UnhandledError exceptions
 * and sends warnings and other info to the underlying reporter.
 */
class ThrowingReporter(reportInfo: Reporter) extends Reporter {
  def doReport(dia: Diagnostic)(using Context): Unit = dia match {
    case dia: Error => throw UnhandledError(dia)
    case _ => reportInfo.doReport(dia)
  }
}

class UnhandledError(val diagnostic: Error) extends Exception:
  override def getMessage = diagnostic.message





© 2015 - 2025 Weber Informatics LLC | Privacy Policy