changeset 43:8621a6e2fe38

actual sane error handling that human beings can read and decipher
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 01 Sep 2010 07:22:58 -0700
parents e0e1a339070c
children 445af840aa5c
files decoupage/web.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/web.py	Wed Sep 01 07:14:10 2010 -0700
+++ b/decoupage/web.py	Wed Sep 01 07:22:58 2010 -0700
@@ -3,6 +3,7 @@
 """
 
 import os
+import sys
 
 from contenttransformer.app import FileTypeTransformer
 from contenttransformer.app import transformers
@@ -11,6 +12,7 @@
 from genshi.builder import Markup
 from genshi.template import TemplateLoader
 from genshi.template.base import TemplateError
+from genshi.template.base import TemplateSyntaxError
 from martini.config import ConfigMunger
 from paste.fileapp import FileApp
 from pkg_resources import resource_filename
@@ -167,8 +169,9 @@
         try:
             template = self.loader.load(template)
             res = template.generate(**data).render('html', doctype='html')
-        except TemplateError:
+        except (TemplateError, TemplateSyntaxError), e:
             if local_index:
+                print repr(e)
                 return self.fileserver(local_index)
             raise