1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +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'
if hasattr(exc, 'url'):
err_url = exc.url
try:
err_url = exc.url.decode('utf-8', 'ignore')
except Exception:
err_url = None
else:
err_url = None
try:
err_msg = exc.message.encode('utf-8')
err_msg = exc.message.decode('utf-8', 'ignore')
except Exception:
err_msg = exc.message
err_url = ''
if print_trace:
import traceback