aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-03 23:57:57 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-03 23:57:57 +0300
commitc8823ae432d0c162183c82f05170095ab2f6a80a (patch)
tree600cb55332f1454c78dfe177248e59e5e08dae43
parentfix the systemd unit (diff)
downloadlinux-status-c8823ae432d0c162183c82f05170095ab2f6a80a.tar.gz
linux-status-c8823ae432d0c162183c82f05170095ab2f6a80a.zip
server.py: return status 500 on error in app.py
Diffstat (limited to '')
-rwxr-xr-xserver.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/server.py b/server.py
index 24ee72a..a76d2ca 100755
--- a/server.py
+++ b/server.py
@@ -16,7 +16,13 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
request = Request.from_http_path(self.path)
except ValueError:
return super().do_GET()
- request.process().write_as_request_handler(self)
+ try:
+ response = request.process()
+ except:
+ self.send_response(http.server.HTTPStatus.INTERNAL_SERVER_ERROR)
+ self.end_headers()
+ return
+ response.write_as_request_handler(self)
def main():