-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Increased maximum length of displayed error message #8658
Conversation
Quality Gate passedIssues Measures |
WalkthroughThe changes involve modifications to the error handling logic in 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 (3)
cvat-ui/src/config.tsx (1)
111-111
: LGTM! Consider enhancing the inline comment.The constant definition is well-placed and the value (600) seems reasonable for error messages.
Consider making the comment more descriptive:
-const MAXIMUM_NOTIFICATION_MESSAGE_LENGTH = 600; // all above will be sent to console +const MAXIMUM_NOTIFICATION_MESSAGE_LENGTH = 600; // Messages longer than this limit will be truncated in UI but fully logged to consolecvat-ui/src/components/cvat-app.tsx (2)
401-407
: Consider improving the Markdown link detection regex.While excluding URLs from the error message length calculation is a good approach, the current regex could be more precise to handle edge cases.
Consider using this more robust regex that handles nested parentheses and escaping:
- if (/]\(.+\)/.test(error)) { - errorLength = error.replace(/]\(.+\)/, ']').length; + if (/\[([^\]]*)\]\(([^)]+)\)/.test(error)) { + errorLength = error.replace(/\[([^\]]*)\]\(([^)]+)\)/g, '$1').length;
401-415
: Add unit tests for the error handling logic.Please consider adding tests to verify:
- Error message length calculation (with and without Markdown links)
- Behavior when messages exceed
MAXIMUM_NOTIFICATION_MESSAGE_LENGTH
Would you like me to help generate the test cases?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
cvat-ui/src/components/cvat-app.tsx
(1 hunks)cvat-ui/src/config.tsx
(2 hunks)
🔇 Additional comments (2)
cvat-ui/src/config.tsx (1)
194-194
: LGTM!
The constant is properly exported and maintains alphabetical ordering in the exports object.
cvat-ui/src/components/cvat-app.tsx (1)
414-415
: LGTM! Good use of configuration constant.
Moving from a hardcoded value to a configurable constant improves maintainability. The error handling gracefully handles long messages by redirecting them to the console.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #8658 +/- ##
===========================================
- Coverage 74.37% 74.24% -0.14%
===========================================
Files 401 401
Lines 43422 43455 +33
Branches 3951 3949 -2
===========================================
- Hits 32297 32265 -32
- Misses 11125 11190 +65
|
Motivation and context
To show more errors, like this:
Instead of throwing them to console only.
600 characters are still alright to display.
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