Stop spamming Sentry on handled Splitwise 404/403#13
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Tests do not have 100% coverage. Please increase coverage to 100% before approval.
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.
Production was firing handled
SplitwiseNotFoundError(andSplitwiseForbiddenError) into Sentry every time a user submitted a stale Splitwise group ID onPOST /dashboard/setup. The dashboard already converted both into a clean{ hasAccess: false }response, so these were noise events with no user impact.The
splitwise-axiosinterceptor wraps all 4xx responses into typedSplitwiseErrorsubclasses before rejecting. The catch block ingetSplitwiseGroupstill testederror instanceof AxiosError && error.response?.status === 404, so the early-return branches have been dead code since the interceptor was introduced in9e1fbb9. Falling through hitSentry.captureExceptionand returned the genericSplitwiseErrormessage 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.tscovering the four exit paths (200, 403, 404, 500) and assertingSentry.captureExceptionis not called for the expected 404 and 403 cases.Sentry issue: 7442059847.