When url fetch fails with http error, report it instead of just 500
This commit is contained in:
parent
30ed068c33
commit
e499ff6185
@ -119,6 +119,10 @@ def site_dispatch(env, start_response):
|
||||
start_response('404 Not Found', ())
|
||||
yield str(e).encode('utf-8')
|
||||
|
||||
except urllib.error.HTTPError as e:
|
||||
start_response(str(e.code) + ' ' + e.reason, ())
|
||||
yield b'While fetching url, the following error occured:\n' + str(e).encode('utf-8')
|
||||
|
||||
except socket.error as e:
|
||||
start_response('502 Bad Gateway', ())
|
||||
print(str(e))
|
||||
|
Loading…
x
Reference in New Issue
Block a user