Thomas Bechtold 28cc5cbe69 magic-proxy: fix exception handling for URLError LP:#1946520
A urllib.error.URLError.reason variable can either be a string or
another Exception[0]. In case it's another exception, the current code
fails because the exception is passed into send_error() which tries
call html.escape() on the Exception. That fails because the Exception
is not a string. Converting the Exception to a string fixes this.

This fixes:

AttributeError: 'TimeoutError' object has no attribute 'replace'

[0]
https://docs.python.org/3/library/urllib.error.html#urllib.error.URLError.reason

(cherry picked from commit af888e24ff8ec478b490c6d0fc39131cd63a8079)
2021-10-26 16:50:13 +02:00
2009-09-15 13:20:15 +01:00
Description
Languages
Shell 86.9%
Python 11%
Perl 2.1%