Skip to content

SDK: More resilient HTTPStatus errors - #339

Merged
mjcurran merged 1 commit into
masterfrom
lp/http-error
Aug 25, 2026
Merged

SDK: More resilient HTTPStatus errors#339
mjcurran merged 1 commit into
masterfrom
lp/http-error

Conversation

@lucaspar

@lucaspar lucaspar commented Aug 25, 2026

Copy link
Copy Markdown
Member

Non-standard 499 (Client Closed Request) errors were raising ValueError.


Note

Low Risk
Localized error-handling change with tests; no auth or data-path behavior change beyond avoiding crashes on uncommon status codes.

Overview
Non-standard HTTP response codes (e.g. nginx 499) no longer crash the SDK when HTTPStatus(code) raises ValueError.

The PR adds _safe_http_status, which returns a normal HTTPStatus when possible or a small _SyntheticHTTPStatus fallback with the same is_success / is_client_error / is_server_error helpers. success_or_raise and GatewayClient.authenticate now use this helper instead of constructing HTTPStatus directly, so errors are classified and raised as SDSError, ServiceError, etc., with the API error body. Tests cover 499 (client) and 599 (server).

Reviewed by Cursor Bugbot for commit 691abeb. Configure here.

@lucaspar
lucaspar requested a review from mjcurran August 25, 2026 17:48
@lucaspar lucaspar self-assigned this Aug 25, 2026
@lucaspar lucaspar added bug Something isn't working sdk SDK component labels Aug 25, 2026
@semanticdiff-com

semanticdiff-com Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  sdk/src/spectrumx/gateway.py  0% smaller
  sdk/src/spectrumx/ops/network.py  0% smaller
  sdk/tests/ops/test_network.py  0% smaller

@mjcurran
mjcurran merged commit 924868a into master Aug 25, 2026
3 checks passed
@mjcurran
mjcurran deleted the lp/http-error branch August 25, 2026 19:18
@mjcurran

Copy link
Copy Markdown
Collaborator

@klpoland Does this PR warrant another SDK version release? I was assuming so, but I don't know if there's a schedule to follow, or other criteria for when a release is deployed to pypi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working sdk SDK component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants