fix: fallback to type name in from_exception when exception has no message#650
fix: fallback to type name in from_exception when exception has no message#650owenpearson merged 1 commit intomainfrom
from_exception when exception has no message#650Conversation
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ably/util/exceptions.py (1)
76-87:from_exceptionenhancement looks correct; consider optionally wiringcauseThe new construction of
exc_type/exc_msgand fallback to the exception type name when the message is empty cleanly solves the “Unexpected exception:” blank-message issue and also improves context by including the type when a message exists. The behavior for existingAblyExceptioninstances remains unchanged, and status/code semantics are preserved.As a minor optional improvement, you could also pass the original exception as
causewhen constructing theAblyException(in addition toraise ... from e), so callers that inspectAblyException.causeget structured access to the wrapped exception:- return AblyException(f"Unexpected exception: {message}", 500, 50000) + return AblyException( + f"Unexpected exception: {message}", + 500, + 50000, + cause=e, + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
ably/util/exceptions.py(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: check (3.12)
- GitHub Check: check (3.8)
- GitHub Check: check (3.13)
- GitHub Check: check (3.9)
- GitHub Check: check (3.11)
- GitHub Check: check (3.10)
- GitHub Check: check (3.7)
httpx errors for example have no message so a http open timeout in
rest.time()would result in an error message of "Unexpected exception:"Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.