Commit 11624a9
Thread code and raw_message through leader-change connect rewrap
A leader-change OperationalError(code=10250 / 10506, raw_message=...)
that the OPEN step of DqliteConnection.connect() catches was rewrapped
into a bare DqliteConnectionError, dropping both code and raw_message.
The dbapi's connect-path classifier comment advertises preservation of
the server-supplied code "matching the query path" — but the
OperationalError arm was unreachable for leader-change codes because
the client's connect() rewrap got there first. SA's is_disconnect
code-based classifier could only fall back to the substring branch
(works today, breaks on a future message rewording), and forensic
consumers had to walk __cause__ to recover the verbatim server text.
Extend DqliteConnectionError.__init__ with optional keyword-only
``code`` and ``raw_message`` (defaulting None for backwards-compat),
thread both through the leader-change rewrap, and propagate them on
the dbapi side via the DqliteConnectionError catch arm in
_build_and_connect. Pin the new shape and the no-arg / message-only
backwards-compat construction.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 04961bd commit 11624a9
3 files changed
Lines changed: 87 additions & 3 deletions
File tree
- src/dqliteclient
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
1121 | | - | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
1122 | 1130 | | |
1123 | | - | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1124 | 1134 | | |
1125 | 1135 | | |
1126 | 1136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
25 | 49 | | |
26 | 50 | | |
27 | 51 | | |
| |||
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
0 commit comments