From 16012f6f02df1daa83948a8afa291123a62f8047 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 10 Aug 2022 17:59:27 -0400 Subject: [PATCH] Include both symbols in error msg when a mismatch --- piker/clearing/_client.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/piker/clearing/_client.py b/piker/clearing/_client.py index 3e87ab96..11eb9b69 100644 --- a/piker/clearing/_client.py +++ b/piker/clearing/_client.py @@ -83,7 +83,13 @@ class OrderBook: """Cancel an order (or alert) in the EMS. """ - cmd = self._sent_orders[uuid] + cmd = self._sent_orders.get(uuid) + if not cmd: + log.error( + f'Unknown order {uuid}!?\n' + f'Maybe there is a stale entry or line?\n' + f'You should report this as a bug!' + ) msg = Cancel( oid=uuid, symbol=cmd.symbol, @@ -156,7 +162,10 @@ async def relay_order_cmds_from_sync_code( # send msg over IPC / wire await to_ems_stream.send(cmd) else: - log.warning(f'Ignoring unmatched order cmd for {sym}: {msg}') + log.warning( + f'Ignoring unmatched order cmd for {sym} != {symbol_key}:' + f'\n{msg}' + ) @acm