From 47f81b31af507503f5d97a5de754961a10ff6bd7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 16 Sep 2022 16:41:26 -0400 Subject: [PATCH] Kraken can cause status msg key error!? --- piker/clearing/_ems.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 045134bc..fe60a551 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -884,11 +884,15 @@ async def translate_and_relay_brokerd_events( oid = book._ems2brokerd_ids.inverse.get(reqid) msg = f'Unhandled broker status for dialog {reqid}:\n' if oid: - status_msg = book._active[oid] - msg += ( - f'last status msg: {pformat(status_msg)}\n\n' - f'this msg:{fmsg}\n' - ) + status_msg = book._active.get(oid) + # status msg may not have been set yet or popped? + # NOTE: have seen a key error here on kraken + # clearable limits.. + if status_msg: + msg += ( + f'last status msg: {pformat(status_msg)}\n\n' + f'this msg:{fmsg}\n' + ) log.warning(msg)