changeset 522:094bdf2f7c4c

serve: Say what page a rendering error happened in.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 28 Jul 2015 21:23:50 -0700
parents 39175c48a4ae
children b22e69ff54f4
files piecrust/rendering.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/rendering.py	Tue Jul 28 21:23:11 2015 -0700
+++ b/piecrust/rendering.py	Tue Jul 28 21:23:50 2015 -0700
@@ -278,6 +278,9 @@
             rp.render_info[PASS_RENDERING] = RenderPassInfo._fromJson(
                 layout_result['pass_info'])
         return rp
+    except Exception as ex:
+        page_rel_path = os.path.relpath(page.path, ctx.app.root_dir)
+        raise Exception("Error rendering page: %s" % page_rel_path) from ex
     finally:
         ctx.setCurrentPass(PASS_NONE)
         eis.popPage()