diff --git a/src/atm/main.py b/src/atm/main.py index 333b5f8..965fdd4 100644 --- a/src/atm/main.py +++ b/src/atm/main.py @@ -846,9 +846,15 @@ async def run_live_async(cfg, duration_s=None, capture_stub: bool = False) -> No while True: try: cmd = cmd_queue.get_nowait() - await _dispatch_command(cmd) except asyncio.QueueEmpty: break + try: + await _dispatch_command(cmd) + except Exception as _cmd_exc: + _msg = f"/{cmd.action}: {_cmd_exc}" + audit.log({"ts": time.time(), "event": "command_error", "action": cmd.action, "error": str(_cmd_exc)}) + print(f"ERR command_dispatch {_msg}", flush=True) + notifier.send(Alert(kind="warn", title=f"Eroare comandă /{cmd.action}", body=str(_cmd_exc))) await asyncio.sleep(cfg.loop_interval_s)