aboutsummaryrefslogtreecommitdiff
path: root/mavlink-library/src/main/scala/com/github/jodersky/mavlink/Reporter.scala
blob: cec6572bacd792a45fc6c27120f4c8338dd5ca77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.github.jodersky.mavlink

import java.io.File

import scala.xml.Node

trait Reporter {

  protected def printWarning(msg: String): Unit

  def fatal(message: String, node: Node, file: File) = throw new ParseError(s"Parse error: $message at $node in file ${file.getAbsolutePath}")
  def warn(message: String, node: Node, file: File) =  printWarning(s"Parse warning: $message at ${node} in file ${file.getAbsolutePath}")

}

object StandardReporter extends Reporter {
  protected def printWarning(msg: String): Unit = Console.err.println(msg)
}