-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Client enables logging non-typical error responses from the server #8538
Conversation
WalkthroughThe changes involve a modification to the Changes
Poem
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)
cvat-ui/src/reducers/notifications-reducer.ts (2)
33-40
: LGTM! Consider extracting the ignored codes list.The changes to the
shouldLog
function look good and align with the PR objective. The implementation correctly filters out common HTTP status codes while allowing logging for non-typical error responses.Consider extracting the list of ignored codes into a constant at the top of the file for better maintainability:
const IGNORED_ERROR_CODES = [0, 400, 401, 403, 404, 405, 500]; // Then in the shouldLog function: return !IGNORED_ERROR_CODES.includes(error.code);This makes it easier to modify the list in the future if needed.
33-40
: Impact analysis: Changes align with PR objectiveThe modifications to the
shouldLog
function will result in more selective logging of ServerError instances throughout the reducer. This aligns well with the PR objective of enabling logging for non-typical error responses.To further improve error handling:
- Consider adding a logging service that can provide more detailed error information for debugging purposes.
- Implement a mechanism to easily configure which error codes should be ignored or logged, possibly through environment variables or a configuration file.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8538 +/- ##
===========================================
- Coverage 74.24% 74.21% -0.04%
===========================================
Files 400 400
Lines 43207 43210 +3
Branches 3905 3906 +1
===========================================
- Hits 32081 32067 -14
- Misses 11126 11143 +17
|
Motivation and context
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit
ServerError
based on specific error codes, reducing unnecessary log entries.