diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-12-21 01:28:28 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-12-21 01:28:28 -0800 |
commit | e499ff6185b8f7a87de3dd4fd81f34f70fd2f9c0 (patch) | |
tree | d7bdee5e254d6d683b239aedabda06166dc96384 | |
parent | 30ed068c3368860fb3fc7fcbc9a1d92365955a7f (diff) | |
download | yt-local-e499ff6185b8f7a87de3dd4fd81f34f70fd2f9c0.tar.lz yt-local-e499ff6185b8f7a87de3dd4fd81f34f70fd2f9c0.tar.xz yt-local-e499ff6185b8f7a87de3dd4fd81f34f70fd2f9c0.zip |
When url fetch fails with http error, report it instead of just 500
-rw-r--r-- | server.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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)) |