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-code
repair_tests
Gud Boi 2026-03-19 19:45:53 -04:00
parent d2b539edbd
commit 08d159e652
1 changed files with 9 additions and 1 deletions

View File

@ -1306,7 +1306,15 @@ async def deliver_trade_events(
elif isinstance(err, str):
code_part, _, reason = err.rpartition(']')
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>'
# "Warning:" msg codes,