Reject blank input in ParsePhrase with its own argument name - #132
Merged
Merged
Conversation
The empty-input guard returned new Phrase([]), which the Phrase constructor rejects, so every blank call threw an ArgumentException naming the constructor's internal 'sequence' parameter. The guard now throws for 'phraseString', as ParseChord does for 'chordString'. Fixes #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G89GFC9HBcemu37GarNas1
|
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.



Fixes #128
What changed
KeybindingService.ParsePhrasehad an empty-input guard that returnednew Phrase([]). ThePhraseconstructor rejects an empty sequence, so that branch never returned. Everynull,""or whitespace call threwArgumentException: Phrase must contain at least one chord (Parameter 'sequence'), which names a parameter the caller never passed.This takes the minimal option from the issue and its triage comment. The guard now throws
ArgumentException("Phrase string cannot be null or whitespace", nameof(phraseString)), the same contractParseChorduses forchordString. The public signature stays the same. Blank input still throwsArgumentException, but the message andParamNameare now correct. The interface doc gains the matching<exception>tag.If a
Phrase?/TryParsePhraseAPI is wanted later, that's a separate API decision, left to the maintainer.Tests
ParsePhraseEmptyInputTestschecks that""," "andnullthrowArgumentExceptionwithParamName == "phraseString". All three fail onmain, whereParamNameissequence, and pass with the fix. The full suite passes: 90/90.🤖 Generated with Claude Code
https://claude.ai/code/session_01G89GFC9HBcemu37GarNas1
Generated by Claude Code