aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/reporting/ThrowingReporter.scala
blob: d8e03ab66ab882167fe1548be7df7a716da9c401 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package dotty.tools
package dotc
package reporting

import core.Contexts.Context
import collection.mutable
import diagnostic.MessageContainer
import diagnostic.messages.Error
import Reporter._

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