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:
1 file changed
+9
-4
@@ -363,10 +363,15 @@ class TestNode():
|
|||||||
latest_error = suppress_error(f"JSONRPCException {e.error['code']}", e)
|
latest_error = suppress_error(f"JSONRPCException {e.error['code']}", e)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
error_num = e.errno
|
error_num = e.errno
|
||||||
# Work around issue where socket timeouts don't have errno set.
|
if error_num is None:
|
||||||
# https://github.com/python/cpython/issues/109601
|
# Work around issue where socket timeouts don't have errno set.
|
||||||
if error_num is None and isinstance(e, TimeoutError):
|
# https://github.com/python/cpython/issues/109601
|
||||||
error_num = errno.ETIMEDOUT
|
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.
|
# Suppress similarly to the above JSONRPCException errors.
|
||||||
if error_num not in [
|
if error_num not in [
|
||||||
|
|||||||
Reference in new issue
Block a user