From f02ea377623b087e2699fcbd59ac28b263fb52a3 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Mon, 18 May 2020 01:40:19 -0400 Subject: [PATCH] Add exception logging --- jetforce/protocol.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetforce/protocol.py b/jetforce/protocol.py index 3feffcd..cd435c3 100644 --- a/jetforce/protocol.py +++ b/jetforce/protocol.py @@ -1,6 +1,7 @@ from __future__ import annotations import time +import traceback import typing import urllib.parse @@ -89,6 +90,7 @@ class GeminiProtocol(LineOnlyReceiver): self.parse_header() except Exception: # Malformed request, throw it away and exit immediately + self.server.log_message(traceback.format_exc()) self.write_status(Status.BAD_REQUEST, "Malformed request") self.flush_status() self.transport.loseConnection() @@ -106,6 +108,7 @@ class GeminiProtocol(LineOnlyReceiver): except StopIteration: break except Exception: + self.server.log_message(traceback.format_exc()) self.write_status(Status.CGI_ERROR, "An unexpected error occurred") finally: self.flush_status()