Skip to content

[ECO-5423] All errors via chat error - #331

Merged
maratal merged 1 commit into
mainfrom
301-all-errors-via-ChatError
Jul 23, 2025
Merged

[ECO-5423] All errors via chat error#331
maratal merged 1 commit into
mainfrom
301-all-errors-via-ChatError

Conversation

@maratal

@maratal maratal commented Jul 13, 2025

Copy link
Copy Markdown
Contributor

Closes #301

Summary by CodeRabbit

  • New Features

    • Introduced a specific error message when a client ID is missing, guiding users to initialize their Realtime instance with a client ID.
  • Bug Fixes

    • Improved consistency and clarity of error handling related to missing client IDs during chat operations.

@coderabbitai

coderabbitai Bot commented Jul 13, 2025

Copy link
Copy Markdown

Walkthrough

The changes introduce a dedicated clientIdRequired error case in the internal error handling system, updating all relevant code paths to throw this specific ChatError instead of a generic custom error code. This ensures that errors related to missing clientId consistently use the new error case throughout the codebase.

Changes

File(s) Change Summary
Sources/AblyChat/Errors.swift Added clientIdRequired case to error enums, updated error code/status mapping, and descriptions
Sources/AblyChat/ChatAPI.swift, Sources/AblyChat/Room.swift Updated error thrown for missing clientId to use ChatError.clientIdRequired

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ChatAPI
    participant Errors

    Client->>ChatAPI: sendMessage() / updateMessage() / Room init
    ChatAPI->>ChatAPI: Check if realtime.clientId is present
    alt clientId is missing
        ChatAPI->>Errors: throw ChatError.clientIdRequired
    else clientId is present
        ChatAPI->>ChatAPI: Proceed with operation
    end
Loading

Estimated code review effort

2 (~20 minutes)

Suggested reviewers

  • lawrence-forooghian
  • umair-ably

Poem

A hop and a skip, a bug we did find,
Missing client IDs—oh, what a bind!
Now errors are tidy, with reasons so clear,
Through ChatError they travel, no need to fear.
With every new case, our code’s more refined,
The chat’s now robust, and the bunnies don’t mind! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a87908c and 42874c6.

📒 Files selected for processing (3)
  • Sources/AblyChat/ChatAPI.swift (2 hunks)
  • Sources/AblyChat/Errors.swift (7 hunks)
  • Sources/AblyChat/Room.swift (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Sources/AblyChat/Room.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • Sources/AblyChat/ChatAPI.swift
  • Sources/AblyChat/Errors.swift
⏰ 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). (35)
  • GitHub Check: Xcode, iOS (Xcode 16.1)
  • GitHub Check: Xcode, tvOS (Xcode 16.3)
  • GitHub Check: Xcode, tvOS (Xcode 16.1)
  • GitHub Check: Xcode, iOS (Xcode 16.3)
  • GitHub Check: Xcode, macOS (Xcode 16.3)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16.3)
  • GitHub Check: Xcode, tvOS (Xcode 16.2)
  • GitHub Check: Xcode, macOS (Xcode 16.1)
  • GitHub Check: Xcode, macOS (Xcode 16.2)
  • GitHub Check: Xcode, iOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16.3)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16.3)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16.2)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16.1)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16.1)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16.1)
  • GitHub Check: Example app, macOS (Xcode 16.3)
  • GitHub Check: Example app, tvOS (Xcode 16.2)
  • GitHub Check: Example app, iOS (Xcode 16.1)
  • GitHub Check: Example app, tvOS (Xcode 16.1)
  • GitHub Check: Example app, iOS (Xcode 16.3)
  • GitHub Check: Example app, macOS (Xcode 16.1)
  • GitHub Check: Example app, tvOS (Xcode 16.3)
  • GitHub Check: Example app, macOS (Xcode 16.2)
  • GitHub Check: Example app, iOS (Xcode 16.2)
  • GitHub Check: SPM, release configuration (Xcode 16.3)
  • GitHub Check: SPM, release configuration (Xcode 16.2)
  • GitHub Check: SPM (Xcode 16.3)
  • GitHub Check: SPM (Xcode 16.1)
  • GitHub Check: SPM, release configuration (Xcode 16.1)
  • GitHub Check: SPM (Xcode 16.2)
  • GitHub Check: lint
  • GitHub Check: Generate code coverage
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 301-all-errors-via-ChatError

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@maratal
maratal changed the base branch from main to 321-soft-deletes-and-validation-loosening July 13, 2025 22:10
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 13, 2025 22:11 Inactive
@maratal
maratal force-pushed the 321-soft-deletes-and-validation-loosening branch 4 times, most recently from 24f4aa2 to 4539d1a Compare July 14, 2025 13:57
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from 8e4aec3 to 291152b Compare July 14, 2025 15:27
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 14, 2025 15:28 Inactive
@maratal
maratal force-pushed the 321-soft-deletes-and-validation-loosening branch from 4539d1a to 7092f9a Compare July 14, 2025 17:00
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from 291152b to 114807a Compare July 14, 2025 17:03
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 14, 2025 17:04 Inactive
@maratal
maratal force-pushed the 321-soft-deletes-and-validation-loosening branch from 7092f9a to 7c46c08 Compare July 14, 2025 17:05
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from 114807a to 2bd6023 Compare July 14, 2025 17:06
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 14, 2025 17:08 Inactive
@maratal

maratal commented Jul 14, 2025

Copy link
Copy Markdown
Contributor Author

See this comment re fails

@maratal
maratal marked this pull request as ready for review July 14, 2025 17:17
@maratal
maratal force-pushed the 321-soft-deletes-and-validation-loosening branch 4 times, most recently from af1c2f5 to eac37eb Compare July 18, 2025 13:47
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from 2bd6023 to 2065a8a Compare July 18, 2025 13:57
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 18, 2025 13:58 Inactive
@maratal maratal changed the title All errors via chat error [ECO-5423] All errors via chat error Jul 18, 2025
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 19, 2025 00:32 Inactive
@maratal
maratal force-pushed the 321-soft-deletes-and-validation-loosening branch from eac37eb to 6e8bc65 Compare July 19, 2025 16:22
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from 2065a8a to a87908c Compare July 19, 2025 16:26
@github-actions
github-actions Bot temporarily deployed to staging/pull/331/AblyChat July 19, 2025 16:27 Inactive
Base automatically changed from 321-soft-deletes-and-validation-loosening to main July 22, 2025 23:22
@maratal
maratal force-pushed the 301-all-errors-via-ChatError branch from a87908c to 42874c6 Compare July 22, 2025 23:26
@maratal
maratal merged commit c3c358a into main Jul 23, 2025
41 checks passed
@maratal
maratal deleted the 301-all-errors-via-ChatError branch July 23, 2025 11:24
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.

Make all thrown errors go via ChatError

2 participants