Commit 5b67aa1
Add raw_message kwarg to client OperationalError; preserve verbatim server text through dbapi plumbing
The cycle-21 contract said ``raw_message`` is the verbatim
server text — un-truncated, un-suffixed. ``protocol.py``
violated that by composing the peer-address suffix into
the display message BEFORE constructing
``OperationalError``; the constructor then copied the
suffix-contaminated text into ``raw_message``. The dbapi
cursor classifier (which reads ``e.raw_message`` and
plumbs it through to its layer's exceptions) propagated
the contamination verbatim.
Add a keyword-only ``raw_message=`` argument to the
client ``OperationalError.__init__``. When provided, it
is stored verbatim; when omitted, the previous
back-compat behaviour applies (``raw_message`` defaults
to the display ``message``).
Update all 9 ``OperationalError`` raise sites in
``protocol.py`` (8 ``FailureResponse``-driven + the
mid-stream ``_WireServerFailure`` translation) to pass
``raw_message=response.message`` separate from the addr-
suffixed display text. The dbapi-layer plumbing in
``cursor.py:228`` keeps reading ``e.raw_message`` and now
sees clean text.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 70af97d commit 5b67aa1
3 files changed
Lines changed: 96 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
93 | 99 | | |
94 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
| |||
103 | 117 | | |
104 | 118 | | |
105 | 119 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
110 | 126 | | |
111 | 127 | | |
112 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| |||
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| |||
338 | 342 | | |
339 | 343 | | |
340 | 344 | | |
341 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
| |||
378 | 384 | | |
379 | 385 | | |
380 | 386 | | |
381 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
382 | 390 | | |
383 | 391 | | |
384 | 392 | | |
| |||
462 | 470 | | |
463 | 471 | | |
464 | 472 | | |
465 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
466 | 476 | | |
467 | 477 | | |
468 | 478 | | |
| |||
510 | 520 | | |
511 | 521 | | |
512 | 522 | | |
513 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
514 | 526 | | |
515 | 527 | | |
516 | 528 | | |
| |||
534 | 546 | | |
535 | 547 | | |
536 | 548 | | |
537 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
538 | 552 | | |
539 | 553 | | |
540 | 554 | | |
| |||
810 | 824 | | |
811 | 825 | | |
812 | 826 | | |
813 | | - | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
814 | 830 | | |
815 | 831 | | |
816 | 832 | | |
| |||
| 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