From 84d7aa47f3fefe3c69371f3e6dbdcc25047cfd82 Mon Sep 17 00:00:00 2001 From: shadeofblue Date: Wed, 22 Dec 2021 12:40:52 +0100 Subject: [PATCH] improve error reporting... --- goth/assertions/assertions.py | 3 +-- goth/runner/probe/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/goth/assertions/assertions.py b/goth/assertions/assertions.py index 2bddef0d..ca3874b5 100644 --- a/goth/assertions/assertions.py +++ b/goth/assertions/assertions.py @@ -33,7 +33,6 @@ class EventStream(Protocol, AsyncIterable[E]): events_ended: bool """`True` iff there will be no more events.""" - else: EventStream = AsyncIterable @@ -152,7 +151,7 @@ async def func_wrapper(): try: return await self._func(self) except asyncio.CancelledError: - raise AssertionError("Assertion cancelled") + raise AssertionError(f"Assertion cancelled: {self}") finally: self._notify_update_events() diff --git a/goth/runner/probe/__init__.py b/goth/runner/probe/__init__.py index cfca122f..06d63a14 100644 --- a/goth/runner/probe/__init__.py +++ b/goth/runner/probe/__init__.py @@ -394,9 +394,12 @@ async def run_command_on_host( logger.debug("Command task has finished") except Exception as e: - logger.error(f"Cancelling command on error: {e!r}") + logger.error(f"Cancelling command on error: {e!r}, command: `{command}`") if cmd_task and not cmd_task.done(): cmd_task.cancel() + import traceback + + traceback.print_exc() raise finally: