Handle `[Errno ...]` str-errors in `.ib.broker`
Extend the str-type error code parser to also match `[Errno <N>]` prefixed msgs (not just `[code <N>]`) by iterating a list of prefix patterns and `int()`-casting the extracted code on first match. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-coderepair_tests
parent
d2b539edbd
commit
08d159e652
|
|
@ -1306,7 +1306,15 @@ async def deliver_trade_events(
|
||||||
elif isinstance(err, str):
|
elif isinstance(err, str):
|
||||||
code_part, _, reason = err.rpartition(']')
|
code_part, _, reason = err.rpartition(']')
|
||||||
if code_part:
|
if code_part:
|
||||||
_, _, code = code_part.partition('[code')
|
for prefix_patt in [
|
||||||
|
'[Errno ',
|
||||||
|
'[code ',
|
||||||
|
]:
|
||||||
|
code_part, _, code = code_part.partition()
|
||||||
|
if code:
|
||||||
|
code = int(code)
|
||||||
|
break
|
||||||
|
|
||||||
reqid: str = '<unknown>'
|
reqid: str = '<unknown>'
|
||||||
|
|
||||||
# "Warning:" msg codes,
|
# "Warning:" msg codes,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue