export: Print error message if template can't be parsed.

This commit is contained in:
Dylan Araps 2019-02-10 08:07:06 +02:00
parent 668f9bbd5b
commit 1d4127925d
No known key found for this signature in database
GPG Key ID: F635E931C2834999

View File

@ -12,7 +12,13 @@ def template(colors, input_file, output_file=None):
"""Read template file, substitute markers and
save the file elsewhere."""
template_data = util.read_file_raw(input_file)
template_data = "".join(template_data).format(**colors)
try:
template_data = "".join(template_data).format(**colors)
except ValueError:
logging.error("Syntax error in template file '%s'. "
"Are non-marker braces escaped? '{{}}'?" % input_file)
return
util.save_file(template_data, output_file)