Repository navigation
Release 3.4.1: error bodies of every shape raise RushDBError - #33
Merged
Merged
Conversation
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>".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every error body the SDK can receive now raises
RushDBErrorwith 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"}, whereerroris a string. The SDK readerroras an object and raisedAttributeError: 'str' object has no attribute 'get'.Fix: one parser for error bodies, used by direct engine mode, the platform client and uploads. It handles:
{"protocolVersion": 1, "error": {"code", "message", "retryable"}}errormessagebodiesTests: 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_TOKENandRUSHDB_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.