Error API¶
-
class
ConfigError
¶ Error returned from configuration validator. Contains filenames, line numbers, error messages and other info needed to pretty-print error messages.
We don’t provide programmatic API to access the data yet, because we’re not sure about the details yet.
-
output
(stream=None)¶ Output the error to a stream.
Parameters: stream – A text stream (a file open in text mode) to write output to. If not specified error is printed to sys.stderr
. You can useio.StringIO
to collect output to an in-memory buffer.Example:
try: config = read_and_validate(filename, trafaret) except ConfigError as err: err.output(stream=sys.stderr)
-