Skip to content

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Sep 11, 2024

Before this commit, the selection prompt would throw an InvalidOperationException (Sequence contains no elements) and the multi selection prompt would throw an ArgumentOutOfRangeException (Index was out of range. Must be non-negative and less than the size of the collection.)

Both would occur because the prompts were never meant to be empty.

Maybe we should change the SelectionPrompt and MultiSelectionPrompt constructors to always require at least one item so that this situation could never occur? But that would be a breaking change and should be discussed in a separate issue. This one is not breaking and just provides a more understandable error message.


Please upvote 👍 this pull request if you are interested in it.

Before this commit, the selection prompt would throw an `InvalidOperationException` (Sequence contains no elements) and the multi selection prompt would throw an `ArgumentOutOfRangeException` (Index was out of range. Must be non-negative and less than the size of the collection.)

Both would occur because the prompts were never meant to be empty.
Copy link
Contributor

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

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

This makes perfect sense. LGTM 👍

@patriksvensson patriksvensson merged commit c70a8b8 into spectreconsole:main Sep 11, 2024
3 checks passed
@0xced 0xced deleted the empty-prompt branch September 11, 2024 08:22
@0xced 0xced restored the empty-prompt branch September 11, 2024 13:03
@0xced 0xced deleted the empty-prompt branch September 11, 2024 13:04
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