package cook.config.parser

import java.io.File

import mouse.runtime.SourceString
import mouse.runtime.SourceFile

import cook.config.parser.unit._
import cook.util._

object CookParser {

  def parse(filename: String): CookConfig = parse(new File(filename))

  def parse(file: File): CookConfig = {
    val parser = new Parser
    if (!parser.parse(new SourceFile(file.getPath))) {
      // TODO(timgreen): wrapper parser error
      throw new ParserErrorException("Get error when parse: \"%s\"", file.getPath)
    }
    parser.semantics.getConfig
  }
}

class ParserErrorException(error: String, args: Any*) extends CookBaseException(error, args: _*)

package cook.config.parser

import java.io.File

import mouse.runtime.SourceString
import mouse.runtime.SourceFile

import cook.config.parser.unit._

object CookParser {

  def parse(filename: String): CookConfig = parse(new File(filename))

  def parse(file: File): CookConfig = {
    val parser = new Parser
    if (!parser.parse(new SourceFile(file.getPath))) {
      // TODO(timgreen): wrapper parser error
      throw new ParserErrorException(null)
    }
    parser.semantics.getConfig
  }
}

class ParserErrorException(errors: Array[String]) extends RuntimeException

--- 
+++ 
@@ -6,6 +6,7 @@
 import mouse.runtime.SourceFile
 
 import cook.config.parser.unit._
+import cook.util._
 
 object CookParser {
 
@@ -15,10 +16,10 @@
     val parser = new Parser
     if (!parser.parse(new SourceFile(file.getPath))) {
       // TODO(timgreen): wrapper parser error
-      throw new ParserErrorException(null)
+      throw new ParserErrorException("Get error when parse: \"%s\"", file.getPath)
     }
     parser.semantics.getConfig
   }
 }
 
-class ParserErrorException(errors: Array[String]) extends RuntimeException
+class ParserErrorException(error: String, args: Any*) extends CookBaseException(error, args: _*)
Improve parser exception error message
