-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error code when fetching room with inconsistent options #187
Conversation
Warning Rate limit exceeded@lawrence-forooghian has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 4 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThe changes in this pull request involve significant updates to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (2)
Sources/AblyChat/Errors.swift (1)
14-15
: Consider adding more specific error codes for different user error scenarios.While the introduction of
nonspecificUserError
(40000) provides a general error category, it might be too broad. Consider creating more specific error codes for different user error scenarios to help with debugging and error handling.public enum ErrorCode: Int { /// The user attempted to perform an invalid action. case nonspecificUserError = 40000 + /// The user attempted to get a room with inconsistent options. + case inconsistentRoomOptionsError = 40001 + /// The user attempted an invalid room operation. + case invalidRoomOperationError = 40002Tests/AblyChatTests/DefaultRoomsTests.swift (1)
146-152
: Consider adding test cases for error message validation.While the test verifies the error code change from
inconsistentRoomOptions
tononspecificUserError
, it would be beneficial to also validate the error message content to ensure it provides clear guidance to users.await #expect { try await rooms.get(roomID: roomID, options: differentOptions) } throws: { error in isChatError(error, withCodeAndStatusCode: .fixedStatusCode(.nonspecificUserError)) + guard let artError = error as? ARTErrorInfo else { return false } + return artError.message.contains("different set of room options") }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
Sources/AblyChat/Errors.swift
(5 hunks)Tests/AblyChatTests/DefaultRoomsTests.swift
(2 hunks)
🔇 Additional comments (2)
Sources/AblyChat/Errors.swift (1)
176-176
: Verify error mapping consistency.
The change from inconsistentRoomOptions
to nonspecificUserError
in the error mapping needs verification to ensure all error paths are properly updated.
✅ Verification successful
Error mapping is consistent and properly updated
The verification shows that:
- The change from
inconsistentRoomOptions
tononspecificUserError
in error mapping is consistent - All test cases expecting
nonspecificUserError
are aligned with this mapping - The error code mapping in
Errors.swift
correctly mapsinconsistentRoomOptions
case to.fixedStatusCode(.nonspecificUserError)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to inconsistentRoomOptions
# and verify all nonspecificUserError mappings
# Search for any remaining references to inconsistentRoomOptions
echo "Checking for remaining references to inconsistentRoomOptions..."
rg "inconsistentRoomOptions" --type swift
# Search for all mappings to nonspecificUserError
echo "Checking all mappings to nonspecificUserError..."
rg "nonspecificUserError" --type swift -A 2 -B 2
Length of output: 4515
Tests/AblyChatTests/DefaultRoomsTests.swift (1)
186-192
: LGTM: Test cases properly updated for new error code.
The test cases have been correctly updated to expect the new nonspecificUserError
code, maintaining consistency with the changes in Errors.swift
.
I should have done this in e7612c9. The 40000 error code does not have a name in the spec or in the JS Chat SDK, so I took `badRequest` from errors.json [1]. [1] https://github.com/ably/ably-common/blob/main/protocol/errors.json
6dbb93d
to
1756aa3
Compare
I should have done this in e7612c9.
The 40000 error code does not have a name in the spec or in the JS Chat SDK, so
nonspecificUserError
is my invention.Summary by CodeRabbit
Bug Fixes
nonspecificUserError
, instead of the previousinconsistentRoomOptions
.Tests