Add event type into msg dict

flexxin
Tyler Goodlet 2022-06-04 13:44:12 -04:00
parent 41f24f3de6
commit 827b5f9c45
1 changed files with 11 additions and 4 deletions

View File

@ -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()