Skip to content

fix: error handling - #479

Merged
alexanto merged 1 commit into
mainfrom
fix/check-transport-response
Nov 12, 2026
Merged

alexanto merged 1 commit into
mainfrom
fix/check-transport-response

Conversation

@alexanto

@alexanto alexanto commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

guarding a little bit more against custom transport bugs, a broken response should not raise into the caller code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the changes to malformed-response handling for the synchronous and asynchronous API clients.

No open issues 🎉

What changed in this PR

This PR hardens the synchronous and asynchronous API clients so malformed responses from custom transports return False rather than propagate exceptions during registration or metrics submission.

Changes:

  • Moves response validation and logging inside existing exception handlers.
  • Adds regression tests for broken transport responses in both clients.
File Description
UnleashClient/​api_client/​_sync.py Guards registration and metrics response handling against exceptions.
UnleashClient/​api_client/​_async.py Adds equivalent async safeguards while preserving cancellation handling.
tests/​unit_tests/​test_unleash_api_client.py Tests that malformed responses return False for both sync operations.
tests/​unit_tests/​test_async_unleash_api_client.py Tests the same malformed-response behavior for async operations.

Review effort: Balanced

Base automatically changed from fix/charset-decoding to main November 12, 2026 12:18
@alexanto
alexanto force-pushed the fix/check-transport-response branch from 2cd3511 to 512303e Compare November 12, 2026 12:18

@ppicom ppicom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense! Left a note on docstrings, but not blocking

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings are no longer accurate. They say only exceptions from the transport become False. Now a response the SDK can't read does too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings are no longer accurate. They say only exceptions from the transport become False. Now a response the SDK can't read does too.

@github-project-automation github-project-automation Bot moved this from New to Approved PRs in Issues and PRs Nov 12, 2026
@alexanto
alexanto force-pushed the fix/check-transport-response branch from 512303e to c754995 Compare November 12, 2026 13:14
@alexanto

Copy link
Copy Markdown
Contributor Author

fixed docstrings 🙌

@alexanto
alexanto merged commit 3e4fe77 into main Nov 12, 2026
8 checks passed
@alexanto
alexanto deleted the fix/check-transport-response branch November 12, 2026 13:23
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Issues and PRs Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants