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:
parent
751084b097
commit
45628f7963
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user