Skip to content

🥅 server: group api errors by specific reason#786

Merged
cruzdanilo merged 1 commit intomainfrom
catch
Feb 16, 2026
Merged

🥅 server: group api errors by specific reason#786
cruzdanilo merged 1 commit intomainfrom
catch

Conversation

@cruzdanilo
Copy link
Member

@cruzdanilo cruzdanilo commented Feb 16, 2026


Open with Devin

Summary by CodeRabbit

  • Bug Fixes
    • Improved API error grouping so related errors are grouped by specific reason
    • Normalized and standardized error message processing for more consistent responses
    • More robust error parsing and body handling to reduce misclassification of error events

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: 6b00391

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • Improved Error Message Parsing: The error handling logic now correctly extracts the core error message by stripping an 'Error: ' prefix, leading to more accurate status and body parsing.
  • Enhanced Error Body Extraction: Extracted error bodies are now trimmed of leading/trailing whitespace, ensuring cleaner data for fingerprinting.
  • Prioritized Error Fingerprinting: The system now prioritizes using the 'message' field over the 'error' field from JSON bodies when generating error fingerprints, providing more specific categorization.
Changelog
  • .changeset/lucky-wolves-balance.md
    • Added a new changeset file.
  • server/index.ts
    • Modified error message extraction to remove 'Error: ' prefix.
    • Updated error body parsing to trim whitespace.
    • Adjusted the priority for extracting error reasons from JSON bodies, preferring 'message' over 'error'.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Warning

Rate limit exceeded

@cruzdanilo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 3 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Walkthrough

Normalizes 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 code, then message, then error.

Changes

Cohort / File(s) Summary
Changeset
.changeset/lucky-wolves-balance.md
Adds a patch-level changeset entry for @exactly/server noting grouping API errors by specific reason.
Server error handling
server/index.ts
Introduces error message normalization (strip "Error:"), parses status from normalized message, trims and validates body using the normalized message, and adjusts fingerprint JSON parsing priority to prefer json.code, then json.message (string), then json.error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • nfmelendez
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: implementing error grouping by specific reason in the server, which aligns with the code changes that normalize error messages and reorganize fingerprint construction logic.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch catch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

devin-ai-integration[bot]

This comment was marked as resolved.

@sentry
Copy link

sentry bot commented Feb 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.05%. Comparing base (8280e78) to head (6b00391).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ
e2e 69.02% <ø> (+16.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟠 Major

Reverse the priority of json.message and json.error fields 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 error field contains the canonical, specific reason code (e.g., "NotFoundError"), while message contains a generic description (e.g., "Not Found"). Using message first would fragment similar errors under different fingerprints instead of grouping them. Swap to: code → error → message.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@cruzdanilo cruzdanilo merged commit 6b00391 into main Feb 16, 2026
14 of 15 checks passed
@cruzdanilo cruzdanilo deleted the catch branch February 16, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments