Raise MultiselectCommunicatorError:

when failed to write to communicator
This commit is contained in:
NIC619
2019-09-19 21:51:23 +08:00
parent b9d1875027
commit c6294ad19b
3 changed files with 26 additions and 6 deletions

View File

@ -15,7 +15,12 @@ class MultiselectCommunicator(IMultiselectCommunicator):
async def write(self, msg_str: str) -> None:
msg_bytes = encode_delim(msg_str.encode())
await self.read_writer.write(msg_bytes)
try:
await self.read_writer.write(msg_bytes)
except IOException:
raise MultiselectCommunicatorError(
"fail to write to multiselect communicator"
)
async def read(self) -> str:
try: