Skip to content

Conversation

@owenpearson
Copy link
Member

@owenpearson owenpearson commented Dec 11, 2025

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

  • Bug Fixes
    • Enhanced error message handling to include exception type information, providing more detailed diagnostics when unexpected exceptions occur.

✏️ Tip: You can customize this high-level summary in your review settings.

@owenpearson owenpearson requested a review from ttypic December 11, 2025 11:28
@coderabbitai
Copy link

coderabbitai bot commented Dec 11, 2025

Walkthrough

The from_exception method in exception utilities was enhanced to construct more detailed error messages by prefixing the exception type name alongside the message content, improving error visibility when the exception message is empty or absent.

Changes

Cohort / File(s) Summary
Error message enhancement
ably/util/exceptions.py
Enhanced from_exception method to include exception type name in error messages when constructing AblyException objects, providing more detailed context for debugging

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

  • Single, localized change to error message formatting logic
  • Clear improvement to error reporting that aids debugging
  • No changes to public signatures or widespread impact

Poem

🐰 When errors whisper with no name to tell,
Our rabbit fixed the message shell,
Now types speak loud alongside the call—
Better debugging for one and all! 🌟

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing the from_exception method to use exception type names as a fallback when exceptions have no message, which directly addresses the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-from-exception

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
ably/util/exceptions.py (1)

76-87: from_exception enhancement looks correct; consider optionally wiring cause

The new construction of exc_type/exc_msg and 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 existing AblyException instances remains unchanged, and status/code semantics are preserved.

As a minor optional improvement, you could also pass the original exception as cause when constructing the AblyException (in addition to raise ... from e), so callers that inspect AblyException.cause get 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 9005b4e and bdddd04.

📒 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)

Copy link
Contributor

@ttypic ttypic left a comment

Choose a reason for hiding this comment

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

LGTM

@owenpearson owenpearson merged commit b799b9e into main Dec 18, 2025
15 of 17 checks passed
@owenpearson owenpearson deleted the fix-from-exception branch December 18, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants