Commit 306c94ed authored by berumuron's avatar berumuron
Browse files

add: Be more verbose when template fails to render

parent 74706dc7
...@@ -79,11 +79,23 @@ def write_content(content, output_path): ...@@ -79,11 +79,23 @@ def write_content(content, output_path):
# Initialize the template defined within content # Initialize the template defined within content
if template_filepath in templates_cache: if template_filepath in templates_cache:
template = templates_cache[template_filepath] template = templates_cache[template_filepath]
rendered_content = template.render(content.meta) try:
rendered_content = template.render(content.meta)
except Exception as e:
print(
f"An error occured when rendering {content.slug()} in {output_filepath}"
)
raise e
elif os.path.exists(template_filepath): elif os.path.exists(template_filepath):
template = boopsy.Template(template_filepath) template = boopsy.Template(template_filepath)
templates_cache[template_filepath] = template templates_cache[template_filepath] = template
rendered_content = template.render(content.meta) try:
rendered_content = template.render(content.meta)
except Exception as e:
print(
f"An error occured when rendering {content.slug()} in {output_filepath}"
)
raise e
else: else:
rendered_content = content.content() rendered_content = content.content()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment