fix: InvalidNegotiatedProtocol __str__ method

This commit is contained in:
Aditya 2020-08-19 06:25:04 +05:30
parent e3233b79de
commit 30eb005639
3 changed files with 5 additions and 2 deletions

View File

@ -68,7 +68,7 @@ class H2ConnectionPool:
# Now as we have established a proper HTTP/2 connection
# we fire all the deferred's with the connection instance
pending_requests = self._pending_requests.pop(key)
pending_requests = self._pending_requests.pop(key, None)
while pending_requests:
d = pending_requests.popleft()
d.callback(conn)

View File

@ -39,7 +39,7 @@ class InvalidNegotiatedProtocol(H2Error):
self.negotiated_protocol = negotiated_protocol
def __str__(self) -> str:
return f'InvalidHostname: Expected h2 as negotiated protocol, received {self.negotiated_protocol!r}'
return f'InvalidNegotiatedProtocol: Expected h2 as negotiated protocol, received {self.negotiated_protocol!r}'
class RemoteTerminatedConnection(H2Error):

View File

@ -31,6 +31,9 @@ class InactiveStreamClosed(ConnectionClosed):
def __init__(self, request: Request):
self.request = request
def __str__(self) -> str:
return f'InactiveStreamClosed: Connection was closed without sending the request {self.request!r}'
class InvalidHostname(H2Error):