Skip to content

Release 3.4.1: error bodies of every shape raise RushDBError - #33

Merged
1pxone merged 1 commit into
mainfrom
fix/error-body-shapes
Nov 15, 2026
Merged

1pxone merged 1 commit into
mainfrom
fix/error-body-shapes

Conversation

@1pxone

@1pxone 1pxone commented Nov 15, 2026

Copy link
Copy Markdown
Member

Every error body the SDK can receive now raises RushDBError with the message, the error code where there is one, and the HTTP status, instead of crashing.

Bug: in direct mode, the engine answers an auth failure (a bad token, or a read-only capability attempting a write) with {"error": "unauthorized"}, where error is a string. The SDK read error as an object and raised AttributeError: 'str' object has no attribute 'get'.

Fix: one parser for error bodies, used by direct engine mode, the platform client and uploads. It handles:

  • the protocol envelope {"protocolVersion": 1, "error": {"code", "message", "retryable"}}
  • a bare string error
  • platform-style message bodies
  • non-JSON or HTML bodies
  • empty bodies

Tests: unit tests for every shape on all three paths, and live direct-mode tests against a local engine (set RUSHDB_TEST_ENGINE_URL, RUSHDB_TEST_ENGINE_TOKEN and RUSHDB_TEST_ENGINE_CAPABILITY_SECRET, with the engine started with --capability-secret). Lint and mypy clean; 226 tests pass on Python 3.10 and 3.13.

Patch release, no API change.

The engine answers auth failures on its protocol endpoints with a bare
string, {"error":"unauthorized"}, while protocol errors use the envelope
{"protocolVersion":1,"error":{"code","message","retryable"}}. Direct mode
read error.message from that string and crashed with AttributeError on a
bad token or a write with a read-only capability.

Both transports (direct mode and the HTTP client, including raw uploads)
now read error bodies through one parser that accepts the envelope, a
bare string error, flat {code, message}, the API's {statusCode, message,
error} with a message list, plain text, an HTML page and an empty body.
They raise RushDBError with the message, the code where the body names
one (unauthorized for the bare string), and the HTTP status. Plain text
bodies from the HTTP client are now the error message instead of
"HTTP <status>".
@1pxone
1pxone merged commit 6cec473 into main Nov 15, 2026
6 checks passed
@1pxone
1pxone deleted the fix/error-body-shapes branch November 15, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant