Skip to content

Commit

Permalink
Restore unwrapping of exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
elupus committed Apr 27, 2020
1 parent 4c45372 commit e25c571
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -9,7 +9,7 @@

setup(
name="arcam-fmj",
version="0.4.5",
version="0.4.6",
description="A python library for speaking to Arcam receivers",
long_description=long_description,
long_description_content_type="text/x-rst",
Expand Down
12 changes: 8 additions & 4 deletions src/arcam/fmj/client.py
Expand Up @@ -101,10 +101,14 @@ async def cancelled_watcher():
except asyncio.CancelledError:
cancelled.add(True)

async with Nursery() as nursery:
nursery.start_soon(cancelled_watcher())
nursery.start_soon(self._process_data(self._reader))
nursery.start_soon(self._process_heartbeat(self._writer))
try:
async with Nursery() as nursery:
nursery.start_soon(cancelled_watcher())
nursery.start_soon(self._process_data(self._reader))
nursery.start_soon(self._process_heartbeat(self._writer))
except MultiError as e:
if len(e.exceptions) == 1:
raise e.exceptions[0] from e

if cancelled:
raise asyncio.CancelledError
Expand Down

0 comments on commit e25c571

Please sign in to comment.