diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2016-09-21 22:39:11 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2016-09-21 22:39:11 +0100 |
commit | 83cfe03bb180c91f522ebb6688a61182085c6b03 (patch) | |
tree | 5d3cffb5f71de03848160acd3f80b521af478574 | |
parent | 527e0a8f65feaaf9c15954b6f1c8487eb9845477 (diff) | |
download | bottle-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.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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> |