Skip to content

except asyncio.IncompleteReadError insteed of ConnectionError - #45

Open
Jonney wants to merge 2 commits into
yungwine:masterfrom
Jonney:patch-1
Open

except asyncio.IncompleteReadError insteed of ConnectionError#45
Jonney wants to merge 2 commits into
yungwine:masterfrom
Jonney:patch-1

Conversation

@Jonney

@Jonney Jonney commented Jan 27, 2025

Copy link
Copy Markdown

According to the asyncio documentation, readexactly() will raise asyncio.IncompleteReadError, not ConnectionError.

If asyncio.IncompleteReadError is not caught, we will get "Task exception was never retrieved."

According to the asyncio documentation (https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamReader.readexactly), readexactly() will raise asyncio.IncompleteReadError, not ConnectionError.

If asyncio.IncompleteReadError is not caught, we will get "Task exception was never retrieved."
ConnectionError is also necessary.
try:
data = await self.reader.readexactly(data_len)
except ConnectionError:
except (ConnectionError|asyncio.IncompleteReadError):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this not gonna work with pipe, try comma:

        except (ConnectionError, IncompleteReadError):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants