Skip to content

Document and critically review ShellError variants - Ep. 3#8340

Merged
sholderbach merged 29 commits intonushell:mainfrom
sholderbach:errare-humanum-est
Mar 6, 2023
Merged

Document and critically review ShellError variants - Ep. 3#8340
sholderbach merged 29 commits intonushell:mainfrom
sholderbach:errare-humanum-est

Conversation

@sholderbach
Copy link
Copy Markdown
Member

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

Not used in the whole repository
Consider dropping completely as it is a single use variant.

Updated the help label a bit.
Added a help message that informs about the fatal nature of the issues
observed.

Q: @kubouch I wasn't sure if some usages e.g. in `use` are not strictly a
moment where nushell failed over.
Might be worth unifying or updating the `NotFound` variants
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2023

Codecov Report

Merging #8340 (cd25947) into main (4ae1b1c) will decrease coverage by 0.44%.
The diff coverage is 23.58%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8340      +/-   ##
==========================================
- Coverage   68.56%   68.13%   -0.44%     
==========================================
  Files         620      620              
  Lines       99275    99429     +154     
==========================================
- Hits        68070    67743     -327     
- Misses      31205    31686     +481     
Impacted Files Coverage Δ
crates/nu-cmd-lang/src/core_commands/const_.rs 93.33% <0.00%> (ø)
...ates/nu-cmd-lang/src/core_commands/help_modules.rs 79.60% <0.00%> (ø)
crates/nu-cmd-lang/src/core_commands/if_.rs 88.42% <0.00%> (ø)
...ates/nu-cmd-lang/src/core_commands/overlay/hide.rs 92.15% <0.00%> (-2.80%) ⬇️
...ates/nu-cmd-lang/src/core_commands/overlay/use_.rs 90.06% <0.00%> (ø)
crates/nu-cmd-lang/src/core_commands/while_.rs 87.95% <0.00%> (ø)
crates/nu-command/src/bytes/at.rs 70.94% <0.00%> (ø)
crates/nu-command/src/bytes/build_.rs 89.28% <0.00%> (ø)
crates/nu-command/src/bytes/remove.rs 89.82% <0.00%> (ø)
crates/nu-command/src/bytes/replace.rs 91.09% <0.00%> (ø)
... and 100 more

@sholderbach sholderbach marked this pull request as ready for review March 6, 2023 16:12
@sholderbach sholderbach merged commit 62575c9 into nushell:main Mar 6, 2023
@sholderbach sholderbach deleted the errare-humanum-est branch March 11, 2023 17:47
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.

1 participant