Add event type into msg dict
parent
41f24f3de6
commit
827b5f9c45
|
@ -780,23 +780,29 @@ class Client:
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
log.error(errorString)
|
|
||||||
reason = errorString
|
reason = errorString
|
||||||
|
|
||||||
if reqId == -1:
|
if reqId == -1:
|
||||||
# it's a general event?
|
# it's a general event?
|
||||||
key = 'event'
|
key = 'event'
|
||||||
|
log.info(errorString)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
key = 'error'
|
key = 'error'
|
||||||
|
log.error(errorString)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
to_trio.send_nowait((
|
to_trio.send_nowait((
|
||||||
key,
|
key,
|
||||||
|
|
||||||
# error "object"
|
# error "object"
|
||||||
{'reqid': reqId,
|
{
|
||||||
'reason': reason,
|
'type': key,
|
||||||
'contract': contract}
|
'reqid': reqId,
|
||||||
|
'reason': reason,
|
||||||
|
'error_code': errorCode,
|
||||||
|
'contract': contract,
|
||||||
|
}
|
||||||
))
|
))
|
||||||
except trio.BrokenResourceError:
|
except trio.BrokenResourceError:
|
||||||
# XXX: eventkit's ``Event.emit()`` for whatever redic
|
# XXX: eventkit's ``Event.emit()`` for whatever redic
|
||||||
|
@ -2248,6 +2254,7 @@ async def trades_dialogue(
|
||||||
recv_trade_updates,
|
recv_trade_updates,
|
||||||
client=client,
|
client=client,
|
||||||
) as (first, trade_event_stream):
|
) as (first, trade_event_stream):
|
||||||
|
|
||||||
task_status.started(trade_event_stream)
|
task_status.started(trade_event_stream)
|
||||||
await trio.sleep_forever()
|
await trio.sleep_forever()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue