fix(init): replace confusing classifyArgs errors with specific ValidationError messages#979
Merged
Merged
Conversation
…tionError messages ContextError was the wrong class — it's for missing required values, not invalid input. The generated headline "Arguments is required." was nonsensical when the user had already provided args. The actual diagnosis was buried in the "Or:" section instead of leading the message. Switches both error cases to ValidationError and echoes back exactly what the user typed so they can see why each argument was misclassified. Closes https://sentry.sentry.io/issues/7485819399/ Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Contributor
Codecov Results 📊✅ 6986 passed | Total: 6986 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 14204 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 77.08% 77.04% -0.04%
==========================================
Files 320 320 —
Lines 61802 61852 +50
Branches 0 0 —
==========================================
+ Hits 47636 47648 +12
- Misses 14166 14204 +38
- Partials 0 0 —Generated by Codecov Action |
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.
classifyArgswas throwingContextErrorfor two invalid-input cases, which produced the nonsensical headline "Arguments is required." The root cause ("Two targets provided") was buried in the "Or:" alternatives section — exactly where a user's eye goes last.Three problems fixed:
ContextErroris for missing required values. These are invalid-input cases →ValidationError.ContextError("Arguments", ...)→"Arguments is required."makes no sense when the user did provide args.Before (e.g.
sentry init acme/ other/):After:
Closes https://sentry.sentry.io/issues/7485819399/