refactor: simplify error handling and reporting#226
Open
angeloashmore wants to merge 4 commits into
Open
Conversation
64a6f2c to
5ae52a8
Compare
Collapse the 17-branch `catch` dispatcher in `src/index.ts` into a single flow: a pure `formatError` maps a known error to its user-facing message, tracking fires once, and only unknown errors reach Sentry. Segment now records the error message on every failed command. Reword the Type Builder requirement message and link to the repository's settings page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
acb1f83 to
682e15d
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e40fbf8. Configure here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Resolves:
Description
Simplifies the error handling and reporting in
src/index.ts. Thecatchblock was 17 near-identicalinstanceofbranches, each repeating the same tracking boilerplate and differing only in the message printed.formatErrormaps a known error to its user-facing message (orundefinedfor an unexpected one).Also refactors
src/lib/sentry.tsto drop the@sentry/node-coreSDK. It now builds and POSTs the Sentry envelope directly viafetch, removing the dependency.Checklist
Preview
How to QA 1
🤖 Generated with Claude Code
Note
Medium Risk
Custom Sentry ingestion may miss SDK behaviors (sampling, breadcrumbs), and the new rule to report some UnknownRequestError cases to Sentry changes observability for handled network failures.
Overview
Refactors CLI failure handling so one
catchpath formats messages, prints them, ends tracking, and decides Sentry reporting instead of many duplicatedinstanceofbranches.formatErrorcentralizes user-facing copy for known errors; unexpected errors stayundefinedso the stack is rethrown.trackCommandEndnow always runs on failure and passes the formatted message (or raw error) into Segment. Sentry is limited to unhandled errors andUnknownRequestErrorcases without a server message.TypeBuilderRequiredErrornow carriesrepoandhost;initand the formatter point users at the repository settings URL to disable Legacy Builder instead of the prior rollout wording.@sentry/node-coreis removed.setupSentrytakes explicit config fromindex.ts;sentry.tskeeps tags/context in memory and POSTs a minimal Sentry envelope viafetch(stack parsing, 2s timeout, silent failures).Reviewed by Cursor Bugbot for commit ffd3889. Bugbot is set up for automated code reviews on this repo. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩