-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-1689 Make the Atlas Search exception more specific #1794
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
base: v2.x
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR introduces a more specific exception (SearchNotSupportedException) to handle Atlas Search-related errors that occur during aggregation operations. The change improves error handling by catching generic server exceptions and re-throwing them as a more specific exception type when they relate to unsupported search functionality.
- Created a new
SearchNotSupportedExceptionclass to identify and handle search-related server errors - Modified the
Aggregateoperation to catch and re-throw search-specific exceptions during command execution
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Exception/SearchNotSupportedException.php | New exception class that extends ServerException and provides logic to identify search-related errors based on error codes |
| src/Operation/Aggregate.php | Added try-catch block to intercept ServerException and re-throw as SearchNotSupportedException when appropriate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f9c8674 to
604ef77
Compare
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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2.x #1794 +/- ##
============================================
- Coverage 87.73% 87.73% -0.01%
- Complexity 3194 3199 +5
============================================
Files 424 425 +1
Lines 6352 6310 -42
============================================
- Hits 5573 5536 -37
+ Misses 779 774 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| 59, // MongoDB 4 to 6, 7-community: no such command: 'createSearchIndexes' | ||
| 40324, // MongoDB 4 to 6: Unrecognized pipeline stage name: '$listSearchIndexes' | ||
| 115, // MongoDB 7-ent: Search index commands are only supported with Atlas. |
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.
Unfortunately, this is too broad. These error codes can be used for errors unrelated to Atlas Search.
Fix PHPLIB-1689
Conditions imported from https://github.com/mongodb/laravel-mongodb/blob/a2b4ab86dfc9248050b2592d9830773ac335774e/src/Schema/Builder.php#L386-L395