parent
99d4ff5d6b
commit
f08217771c
@ -158,7 +158,19 @@ class Channel:
|
|||||||
|
|
||||||
async def wait_close(self):
|
async def wait_close(self):
|
||||||
try:
|
try:
|
||||||
await self.recv()
|
closure = await self.recv()
|
||||||
|
if not isinstance(closure, dict):
|
||||||
|
raise ValueError("Closure should be of type dict")
|
||||||
|
|
||||||
|
if not closure.get("closure"):
|
||||||
|
raise ValueError("Closure should have closure: True")
|
||||||
|
|
||||||
|
reason = closure.get("reason")
|
||||||
|
if reason != "Utensil complete":
|
||||||
|
raise ValueError(
|
||||||
|
f"Closure was not for the right reason: expected 'Utensil complete'"
|
||||||
|
f", found {reason}"
|
||||||
|
)
|
||||||
raise RuntimeError("Message arrived when expecting closure.")
|
raise RuntimeError("Message arrived when expecting closure.")
|
||||||
except EOFError:
|
except EOFError:
|
||||||
# expected
|
# expected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user