fix: preserve SDK errors from synchronous custom clients

Merged
PE
3d ago
+60-0

When a synchronous custom HTTP client raises an existing ResendError, Request replaces it with a generic 500 HttpClientError, losing the subtype and response headers. This preserves the original exception, matching the async path, so callers can still catch RateLimitError and inspect retry-after. Ordinary transport errors keep their existing wrapping.

Added public Emails.get() regressions for a base SDK error, a rate-limit error, and a RuntimeError control. The two SDK-error cases fail before the change and pass afterward.

Tested: tox -e lint, tox -e mypy, and tox -e py (855 passed); focused tests (5 + 39 passed); Black/isort on changed files; git diff --check.

Prepared with GPT-6.1 Sol (high reasoning) assistance.


Summary by cubic

Preserves ResendError exceptions raised by synchronous custom HTTP clients so they're no longer replaced by a generic 500 HttpClientError. This matches the async behavior and lets callers catch RateLimitError and inspect headers like retry-after; ordinary transport errors still get wrapped as before.

Adds regression tests covering a base SDK error, a rate-limit error, and a RuntimeError control case.