From 49f10cb89ac458270a2ff5a48b2211e5d2c159ab Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 2 Jul 2018 19:41:02 -0700 Subject: 502 Bad Gateway instead of just 500 error --- server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index 1953c39..0482c36 100644 --- a/server.py +++ b/server.py @@ -113,14 +113,15 @@ def site_dispatch(env, start_response): yield error_code('404 Not Found', start_response) return - - except (socket.error, ConnectionAbortedError) as e: - start_response('500 Internal Server Error', ()) + + except socket.error as e: + start_response('502 Bad Gateway', ()) print(str(e)) - yield b'500 Internal Server Error' + yield b'502 Bad Gateway' except Exception: start_response('500 Internal Server Error', ()) + yield b'500 Internal Server Error' raise return -- cgit v1.2.3