Skip to content

Stop spamming Sentry on handled Splitwise 404/403#13

Merged
danthareja merged 1 commit into
mainfrom
fix/getsplitwisegroup-sentry-noise
Apr 27, 2026
Merged

Stop spamming Sentry on handled Splitwise 404/403#13
danthareja merged 1 commit into
mainfrom
fix/getsplitwisegroup-sentry-noise

Conversation

@danthareja

Copy link
Copy Markdown
Owner

Production was firing handled SplitwiseNotFoundError (and SplitwiseForbiddenError) into Sentry every time a user submitted a stale Splitwise group ID on POST /dashboard/setup. The dashboard already converted both into a clean { hasAccess: false } response, so these were noise events with no user impact.

The splitwise-axios interceptor wraps all 4xx responses into typed SplitwiseError subclasses before rejecting. The catch block in getSplitwiseGroup still tested error instanceof AxiosError && error.response?.status === 404, so the early-return branches have been dead code since the interceptor was introduced in 9e1fbb9. Falling through hit Sentry.captureException and returned the generic SplitwiseError message in place of the original "Group not found" / "No access to group". Matching on the typed subclasses fixes both the noise and the regressed error strings. The unexpected-error path (5xx, network, malformed responses) still reports to Sentry.

Adds tests/services/splitwise-auth.test.ts covering the four exit paths (200, 403, 404, 500) and asserting Sentry.captureException is not called for the expected 404 and 403 cases.

Sentry issue: 7442059847.


Compound Engineering
Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
splitwise-for-ynab Error Error Apr 27, 2026 3:31pm

@danthareja danthareja merged commit e8f9bfc into main Apr 27, 2026
2 of 4 checks passed
@danthareja danthareja deleted the fix/getsplitwisegroup-sentry-noise branch April 27, 2026 15:32

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tests do not have 100% coverage. Please increase coverage to 100% before approval.

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.

2 participants