Skip to content

Commit da0ee91

Browse files
Document FailureResponse.code as SQLite error code
The ``code`` field is the SQLite error code (SQLITE_OK=0, SQLITE_ERROR=1, etc.) or an extended dqlite code. Previously the field had no docstring, leaving callers to guess whether 0 meant "success" or the SQLite "generic error" code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f12a1cd commit da0ee91

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/dqlitewire/messages/responses.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class FailureResponse(Message):
4444
"""Operation failed.
4545
4646
Body: uint64 code, text message
47+
48+
The ``code`` field contains a SQLite error code (or extended error code).
49+
Common values include ``SQLITE_ERROR`` (1), ``SQLITE_BUSY`` (5), and the
50+
dqlite-specific extended codes ``SQLITE_IOERR_NOT_LEADER`` (the node is
51+
not the cluster leader) and ``SQLITE_IOERR_LEADERSHIP_LOST`` (leadership
52+
was lost during the operation). See the `SQLite result codes documentation
53+
<https://www.sqlite.org/rescode.html>`_ for the full list.
4754
"""
4855

4956
MSG_TYPE: ClassVar[int] = ResponseType.FAILURE

0 commit comments

Comments
 (0)