From 12598924a49d41591adfd2b70fb9c52e43b4f58c 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 | 2 +- goth/runner/probe/__init__.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/goth/assertions/assertions.py b/goth/assertions/assertions.py index 2bddef0d..df5426bf 100644 --- a/goth/assertions/assertions.py +++ b/goth/assertions/assertions.py @@ -152,7 +152,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..e754eb2d 100644 --- a/goth/runner/probe/__init__.py +++ b/goth/runner/probe/__init__.py @@ -8,6 +8,7 @@ import logging import os from pathlib import Path +import traceback from typing import ( AsyncIterator, Dict, @@ -394,9 +395,10 @@ 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() + traceback.print_exc() raise finally: