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