From 827b5f9c45ef70ea5a2cc7bf13cc18a883a4ce5a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 4 Jun 2022 13:44:12 -0400 Subject: [PATCH] Add event type into msg dict --- piker/brokers/ib.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index f311477b..9b32521f 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -780,23 +780,29 @@ class Client: ) -> None: - log.error(errorString) reason = errorString if reqId == -1: # it's a general event? key = 'event' + log.info(errorString) + else: key = 'error' + log.error(errorString) try: to_trio.send_nowait(( key, # error "object" - {'reqid': reqId, - 'reason': reason, - 'contract': contract} + { + 'type': key, + 'reqid': reqId, + 'reason': reason, + 'error_code': errorCode, + 'contract': contract, + } )) except trio.BrokenResourceError: # XXX: eventkit's ``Event.emit()`` for whatever redic @@ -2248,6 +2254,7 @@ async def trades_dialogue( recv_trade_updates, client=client, ) as (first, trade_event_stream): + task_status.started(trade_event_stream) await trio.sleep_forever()