I'm writing a Python-based parser that can understand some configuration files that we use. The files will basically consist of (name, type) and (name, value) pairs:
Parameter file:
# defines a field called some_bool of type boolean
some_bool : bool
Config file:
# assigns True to some_bool
some_bool = bool
I'm not sure what to do when I encounter a syntax error inside a file I am parsing:
# bol instead of bool
some_bool : bol
Is it bad form to raise a SyntaxError exception in that case or are SyntaxError exceptions better left to show problems in Python code?
SyntaxErrormight be confusing. Either I'd create some special exception type called eg.ParseErroror ignore given value and just log in as a warning.