Repository navigation
Name the transport error when httpx gives no message - #58
Conversation
|
👋 Hello @glenn-jocher, thank you for submitting a
For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀 |
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Reviewed the Python transport-error formatting change. The fallback preserves non-empty messages and exception chaining while providing a useful name for empty messages. LGTM; no issues found.
|
🎉 PR #58 has been merged—thank you, @glenn-jocher!
This focused change gives empty-message transport failures a clear reason, such as |
Generated Python clients wrap transport failures as
APIConnectionError(str(error)). Some httpx errors have an empty message, most notably async timeouts (anyio raises a bareTimeoutError, sohttpx.ReadTimeouthas an empty string). Async SDK users then gotAPIConnectionError(''), and CLIs built on the SDK printed a reason with nothing after the colon.The generated client now falls back to the httpx exception class name (
str(error) or type(error).__name__), so an async read timeout reportsReadTimeout. Non-empty messages are unchanged, and the original exception is still chained as__cause__.Validation
bun run generate,typecheck,lint,knip,test(20 pass), andbuildall pass.timeout=0.3andmax_retries=0. The async client raisedAPIConnectionError('')before this change andAPIConnectionError('ReadTimeout')after it. The sync client still raises'timed out'.🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
The generated Python client now uses the httpx exception class name when a transport error has no message, so empty-message failures have a readable error reason.
📊 Key Changes
str(error)totype(error).__name__when creatingAPIConnectionError.__cause__.🎯 Purpose & Impact
ReadTimeoutinstead of an empty reason; the PR validation also confirms the sync timeout still reportstimed out.