summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2016-09-21 22:39:11 +0100
committerEric Wieser <wieser.eric@gmail.com>2016-09-21 22:39:11 +0100
commit83cfe03bb180c91f522ebb6688a61182085c6b03 (patch)
tree5d3cffb5f71de03848160acd3f80b521af478574
parent527e0a8f65feaaf9c15954b6f1c8487eb9845477 (diff)
downloadbottle-83cfe03bb180c91f522ebb6688a61182085c6b03.tar.gz
Handle unprintable errors
Previously, these would throw another error and obliterate the useful traceback, replacing it with a useless one
-rw-r--r--bottle.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bottle.py b/bottle.py
index ff05e61..35b9625 100644
--- a/bottle.py
+++ b/bottle.py
@@ -4112,7 +4112,12 @@ ERROR_PAGE_TEMPLATE = """
<pre>{{e.body}}</pre>
%%if DEBUG and e.exception:
<h2>Exception:</h2>
- <pre>{{repr(e.exception)}}</pre>
+ %%try:
+ %%exc = repr(e.exception)
+ %%except:
+ %%exc = '<unprintable %%s object>' %% type(e.exception).__name__
+ %%end
+ <pre>{{exc}}</pre>
%%end
%%if DEBUG and e.traceback:
<h2>Traceback:</h2>