Document and critically review ShellError variants - Ep. 2#8326
Merged
sholderbach merged 8 commits intonushell:mainfrom Mar 6, 2023
Merged
Document and critically review ShellError variants - Ep. 2#8326sholderbach merged 8 commits intonushell:mainfrom
ShellError variants - Ep. 2#8326sholderbach merged 8 commits intonushell:mainfrom
Conversation
TODO: move things that probably use another error variant either to this or remove the `IncorrectValue` entirely.
Incorporates the once used `TypeMismatchGenericMessage` Still need to figure out what the hell happened that we have a highly messy `TypeMismatch` that regularly seems to concern it self with other things than type errors in the narrow sense.
Observed one case of flagrant misuse of it
We are a bit inconsistent if we provide a long message or the ostensible parameter name based on the signature. We insert this string both in the head message and the tagged label. Here a long string might be confusing
Contributor
|
Nice, thanks! I skimmed the changes to |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8326 +/- ##
==========================================
- Coverage 68.19% 68.16% -0.03%
==========================================
Files 620 620
Lines 99288 99343 +55
==========================================
+ Hits 67705 67719 +14
- Misses 31583 31624 +41
|
Member
Author
The real meat and potatoes for the users is still in all the usages that might use the wrong error type or misunderstood how the fields were intended (or that got more confusing when the format string in the |
sholderbach
added a commit
that referenced
this pull request
Mar 6, 2023
Continuation of #8229 and #8326 # Description The `ShellError` enum at the moment is kind of messy. Many variants are basic tuple structs where you always have to reference the implementation with its macro invocation to know which field serves which purpose. Furthermore we have both variants that are kind of redundant or either overly broad to be useful for the user to match on or overly specific with few uses. So I set out to start fixing the lacking documentation and naming to make it feasible to critically review the individual usages and fix those. Furthermore we can decide to join or split up variants that don't seem to be fit for purpose. # Call to action **Everyone:** Feel free to add review comments if you spot inconsistent use of `ShellError` variants. # User-Facing Changes (None now, end goal more explicit and consistent error messages) # Tests + Formatting (No additional tests needed so far) # Commits (so far) - Remove `ShellError::FeatureNotEnabled` - Name fields on `SE::ExternalNotSupported` - Name field on `SE::InvalidProbability` - Name fields on `SE::NushellFailed` variants - Remove unused `SE::NushellFailedSpannedHelp` - Name field on `SE::VariableNotFoundAtRuntime` - Name fields on `SE::EnvVarNotFoundAtRuntime` - Name fields on `SE::ModuleNotFoundAtRuntime` - Remove usused `ModuleOrOverlayNotFoundAtRuntime` - Name fields on `SE::OverlayNotFoundAtRuntime` - Name field on `SE::NotFound`
46 tasks
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.
Continuation of #8229
Description
The
ShellErrorenum at the moment is kind of messy.Many variants are basic tuple structs where you always have to reference the implementation with its macro invocation to know which field serves which purpose.
Furthermore we have both variants that are kind of redundant or either overly broad to be useful for the user to match on or overly specific with few uses.
So I set out to start fixing the lacking documentation and naming to make it feasible to critically review the individual usages and fix those.
Furthermore we can decide to join or split up variants that don't seem to be fit for purpose.
Everyone: Feel free to add review comments if you spot inconsistent use of
ShellErrorvariants.SE::IncorrectValueSE::TypeMismatchSE::UnsupportedOperatorAssignmentRequires*and fix docSE::UnknownOperatorSE::MissingParameterSE::DelimiterErrorSE::IncompatibleParametersSingleUser-Facing Changes
(None now, end goal more explicit and consistent error messages)
Tests + Formatting
(No additional tests needed so far)