From 9380aeee1741ec4eff69b92df5d11bce08857cc8 Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Sun, 22 Oct 2017 13:27:13 -0500 Subject: [PATCH] Raise if parsing, rendering, or writing fails If jinja template parsing, rendering, or writing fails, we used to log an error message and continue. With this change, we'll raise the original exception so we print the traceback and fail the build right away. Change-Id: I9e92d3aed844d965a425c43c79a8844e5c4bd006 --- tools/www-generator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/www-generator.py b/tools/www-generator.py index 8661c338b..e98868740 100755 --- a/tools/www-generator.py +++ b/tools/www-generator.py @@ -65,7 +65,7 @@ def main(): environment = jinja2.Environment(loader=loader) except Exception as e: logger.error("initialising template environment failed: %s" % e) - return 1 + raise for templateFile in environment.list_templates(): if not templateFile.endswith('.html'): @@ -78,7 +78,7 @@ def main(): except Exception as e: logger.error("parsing template %s failed: %s" % (templateFile, e)) - continue + raise try: output = lxml.html.tostring( @@ -87,7 +87,7 @@ def main(): except Exception as e: logger.error("rendering template %s failed: %s" % (templateFile, e)) - continue + raise try: target_directory = os.path.join(args.output_directory, @@ -102,7 +102,7 @@ def main(): fh.write(output.encode('utf8')) except (IOError, OSError, UnicodeEncodeError) as e: logger.error("writing %s failed: %s" % (target_file, e)) - continue + raise return 0