🥅 server: group api errors by specific reason#786
Conversation
🦋 Changeset detectedLatest commit: 6b00391 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the server's API error handling mechanism to provide more granular and accurate error fingerprinting. By improving the parsing of error messages and their associated JSON bodies, the changes ensure that errors are grouped by their specific reasons, leading to better observability and debugging. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Warning Rate limit exceeded
⌛ 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. WalkthroughNormalizes server error messages by stripping an "Error:" prefix, updates body extraction/validation to use the normalized message, and changes JSON payload parsing order when building error fingerprints to prefer Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request improves error grouping for Sentry by refining the fingerprint generation logic in the onError handler. The changes, such as stripping the "Error: " prefix and trimming the message body, are good improvements for robustness. I've suggested a further refactoring to use a regular expression for parsing the error message, which would make the logic even more robust and maintainable.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #786 +/- ##
==========================================
+ Coverage 68.83% 69.05% +0.22%
==========================================
Files 207 207
Lines 7026 7026
Branches 2219 2219
==========================================
+ Hits 4836 4852 +16
+ Misses 2010 1996 -14
+ Partials 180 178 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/index.ts (1)
286-303:⚠️ Potential issue | 🟠 MajorReverse the priority of
json.messageandjson.errorfields to match the commit intent of grouping errors by specific reason.The current priority (code → message → error) contradicts the commit message "group api errors by specific reason." Real API responses show that the
errorfield contains the canonical, specific reason code (e.g., "NotFoundError"), whilemessagecontains a generic description (e.g., "Not Found"). Usingmessagefirst would fragment similar errors under different fingerprints instead of grouping them. Swap to: code → error → message.
Summary by CodeRabbit