Skip to content

feat(sdk): improve python REST client transport error diagnostics#2942

Merged
mrkaye97 merged 6 commits intohatchet-dev:mk/py-1-22-16from
BloggerBust:feat/issue-2872-rest-error-diagnostics
Feb 5, 2026
Merged

feat(sdk): improve python REST client transport error diagnostics#2942
mrkaye97 merged 6 commits intohatchet-dev:mk/py-1-22-16from
BloggerBust:feat/issue-2872-rest-error-diagnostics

Conversation

@BloggerBust
Copy link
Copy Markdown
Contributor

Refs #2872

Description

This PR improves failure diagnostics in the Python SDK REST client by expanding
the set of transport level exceptions captured and enriching the resulting
ApiException message with request context.

Specifically, when low level urllib3 transport errors occur, such as timeouts,
connection failures, protocol errors, the raised exception now includes:

  • the underlying exception type
  • the original error message
  • HTTP method
  • request URL
  • configured request timeout

This makes timeout and connectivity failures significantly easier to diagnose
without changing retry behavior or public APIs.

This addresses part of the diagnostics concerns raised in #2872.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

What's Changed

  • Expand the set of urllib3 transport exceptions handled by the REST client
  • Improve error messages for transport failures with request context
  • Apply the change via the existing Python SDK patching mechanism

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 4, 2026

@BloggerBust is attempting to deploy a commit to the Hatchet Team on Vercel.

A member of the Team first needs to authorize it.

@mrkaye97
Copy link
Copy Markdown
Contributor

mrkaye97 commented Feb 4, 2026

nice, thanks! mind posting some example errors that are raised here, if possible? (you might be able to simulate them by just raising from inside one of these methods)

@BloggerBust
Copy link
Copy Markdown
Contributor Author

@mrkaye97 no problem! Here are a few simulated examples by raising inside
RESTClientObject.request() (monkeypatching pool_manager.request), showing
the resulting ApiException.reason:

SSLError
bad handshake
method=GET
url=https://example.com/test
timeout=(1, 2)

ConnectTimeoutError
(None, 'connect timed out')
method=GET
url=https://example.com/test
timeout=(1, 2)

ReadTimeoutError
None: read timed out
method=GET
url=https://example.com/test
timeout=(1, 2)

ProtocolError
('connection aborted', OSError('boom'))
method=GET
url=https://example.com/test
timeout=(1, 2)

@mrkaye97
Copy link
Copy Markdown
Contributor

mrkaye97 commented Feb 4, 2026

Nice, thanks! This looks good to me - would you mind bumping the patch version of the package and writing a changelog entry here? Then I'll get this shipped. Thanks for the fix!

@BloggerBust
Copy link
Copy Markdown
Contributor Author

Bumped Python SDK patch version to 1.22.16 and added a changelog entry. Thanks!

@mrkaye97 mrkaye97 changed the base branch from main to mk/py-1-22-16 February 5, 2026 14:23
@mrkaye97 mrkaye97 merged commit dad633e into hatchet-dev:mk/py-1-22-16 Feb 5, 2026
2 of 3 checks passed
@mrkaye97 mrkaye97 mentioned this pull request Feb 5, 2026
1 task
mrkaye97 added a commit that referenced this pull request Feb 5, 2026
* feat(sdk): improve python REST client transport error diagnostics (#2942)

* feat(sdk): improve python REST client transport error diagnostics

Refs #2872

* chore(sdk/python): bump version to 1.22.16

* fix: change from `asyncio` to `inspect` for `.iscoroutinefunction` (#2933)

* fix: change from asyncio.iscoroutinefunction to inspect.iscoroutinefunction

* chore: bump

---------

Co-authored-by: matt <mrkaye97@gmail.com>

---------

Co-authored-by: Trevor Wilson <trevor.wilson@bloggerbust.ca>
Co-authored-by: Stefan <28559054+StefanBRas@users.noreply.github.com>
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.

2 participants