summaryrefslogtreecommitdiff
path: root/tmpl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tmpl.py')
-rw-r--r--tmpl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tmpl.py b/tmpl.py
index 6551728..9748f2a 100644
--- a/tmpl.py
+++ b/tmpl.py
@@ -40,7 +40,10 @@ def expose(filename, method='html', encoding='utf-8', **options):
stream = exc(e)
if not isinstance(stream, Stream):
return stream
- return encode(serializer(stream), method = serializer, encoding = encoding)
+ try:
+ return encode(serializer(stream), method = serializer, encoding = encoding)
+ except Exception, e:
+ return encode(serializer(exc(e)), method = serializer, encoding = encoding)
return wrapper
return decorate