1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-24 06:59:52 +01:00

wsgi_wrapper: ensure error handling doesn't throw decoding errors

This commit is contained in:
Ilya Kreymer 2014-09-06 18:35:30 -07:00
parent 751084b097
commit 45628f7963

View File

@ -121,15 +121,17 @@ class WSGIApp(object):
status = '400 Bad Request' status = '400 Bad Request'
if hasattr(exc, 'url'): if hasattr(exc, 'url'):
err_url = exc.url try:
err_url = exc.url.decode('utf-8', 'ignore')
except Exception:
err_url = None
else: else:
err_url = None err_url = None
try: try:
err_msg = exc.message.encode('utf-8') err_msg = exc.message.decode('utf-8', 'ignore')
except Exception: except Exception:
err_msg = exc.message err_msg = exc.message
err_url = ''
if print_trace: if print_trace:
import traceback import traceback