Immediately return error if detected as pipeline input or positional argument #14874
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.
Description
This PR returns error values while checking pipeline input types and positional argument types. This should help return non-nested errors earlier and prevent confusing errors.
The positional argument change is directly related to an example given on Discord. Before this PR, this is the error shown:
After this PR, this is the error shown:
I'm not certain if the pipeline input error check actually can ever be triggered, but it seems to be a good defensive error handling strategy regardless. My addition of the
Value::Error
case in the first place would suggest it can be, but after looking at it more closely the error that caused me to add the case in the first place was actually unrelated to input typechecking.Additionally, this PR does not affect the handling of nested errors, so something like:
works the same before and after this PR.
User-Facing Changes
Errors values detected as arguments to commands or as pipeline input to commands are immediately thrown, rather than passed to the command.
Tests + Formatting
toolkit fmt
toolkit clippy
toolkit test
toolkit test stdlib
After Submitting
N/A