Show More
@@ -100,16 +100,18 b' class _httprequesthandler(httpservermod.' | |||
|
100 | 100 | def do_POST(self): |
|
101 | 101 | try: |
|
102 | 102 | self.do_write() |
|
103 | except Exception: | |
|
103 | except Exception as e: | |
|
104 | 104 | # I/O below could raise another exception. So log the original |
|
105 | 105 | # exception first to ensure it is recorded. |
|
106 | tb = r"".join(traceback.format_exception(*sys.exc_info())) | |
|
107 | # We need a native-string newline to poke in the log | |
|
108 | # message, because we won't get a newline when using an | |
|
109 | # r-string. This is the easy way out. | |
|
110 | newline = chr(10) | |
|
111 | self.log_error(r"Exception happened during processing " | |
|
112 | r"request '%s':%s%s", self.path, newline, tb) | |
|
106 | if not (isinstance(e, (OSError, socket.error)) | |
|
107 | and e.errno == errno.ECONNRESET): | |
|
108 | tb = r"".join(traceback.format_exception(*sys.exc_info())) | |
|
109 | # We need a native-string newline to poke in the log | |
|
110 | # message, because we won't get a newline when using an | |
|
111 | # r-string. This is the easy way out. | |
|
112 | newline = chr(10) | |
|
113 | self.log_error(r"Exception happened during processing " | |
|
114 | r"request '%s':%s%s", self.path, newline, tb) | |
|
113 | 115 | |
|
114 | 116 | self._start_response(r"500 Internal Server Error", []) |
|
115 | 117 | self._write(b"Internal Server Error") |
@@ -911,18 +911,6 b' Test signal-safe-lock in web and non-web' | |||
|
911 | 911 | errors |
|
912 | 912 | |
|
913 | 913 | $ cat errors.log | "$PYTHON" $TESTDIR/filtertraceback.py |
|
914 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/?cmd=spam': (glob) | |
|
915 | Traceback (most recent call last): | |
|
916 | error: [Errno 104] $ECONNRESET$ | |
|
917 | ||
|
918 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/spam': (glob) | |
|
919 | Traceback (most recent call last): | |
|
920 | error: [Errno 104] $ECONNRESET$ | |
|
921 | ||
|
922 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/spam/tip/foo': (glob) | |
|
923 | Traceback (most recent call last): | |
|
924 | error: [Errno 104] $ECONNRESET$ | |
|
925 | ||
|
926 | 914 | $ rm -f errors.log |
|
927 | 915 | |
|
928 | 916 | Uncaught exceptions result in a logged error and canned HTTP response |
General Comments 0
You need to be logged in to leave comments.
Login now