diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-03 23:57:57 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-03 23:57:57 +0300 |
commit | c8823ae432d0c162183c82f05170095ab2f6a80a (patch) | |
tree | 600cb55332f1454c78dfe177248e59e5e08dae43 /server.py | |
parent | fix the systemd unit (diff) | |
download | linux-status-c8823ae432d0c162183c82f05170095ab2f6a80a.tar.gz linux-status-c8823ae432d0c162183c82f05170095ab2f6a80a.zip |
server.py: return status 500 on error in app.py
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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(): |