qa: Account for errno not always being set for ConnectionResetError

Logging issue can be triggered by:

```diff
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -263,6 +263,7 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
 /** HTTP request callback */
 static void http_request_cb(struct evhttp_request* req, void* arg)
 {
+    throw std::runtime_error{"Hello"};
     evhttp_connection* conn{evhttp_request_get_connection(req)};
     // Track active requests
     {
```

http.client.RemoteDisconnected not specifying errno to ConnectionResetError-ctor:
https://github.com/python/cpython/blob/ce4b0ede16aea62ee7b1e02df7e1538102a356da/Lib/http/client.py#L1556C9-L1556C29
This commit is contained in:
Hodlinator committed 2025-11-14 21:56:38 +01:00
1 parent 25c45bb0d0
commit 76e0e6087d
1 file changed
+9 -4
+9 -4
View File
@@ -363,10 +363,15 @@ class TestNode():
latest_error = suppress_error(f"JSONRPCException {e.error['code']}", e)
except OSError as e:
error_num = e.errno
# Work around issue where socket timeouts don't have errno set.
# https://github.com/python/cpython/issues/109601
if error_num is None and isinstance(e, TimeoutError):
error_num = errno.ETIMEDOUT
if error_num is None:
# Work around issue where socket timeouts don't have errno set.
# https://github.com/python/cpython/issues/109601
if isinstance(e, TimeoutError):
error_num = errno.ETIMEDOUT
# http.client.RemoteDisconnected inherits from this type and
# doesn't specify errno.
elif isinstance(e, ConnectionResetError):
error_num = errno.ECONNRESET
# Suppress similarly to the above JSONRPCException errors.
if error_num not in [