mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 20:37:14 +02:00
Convert more ShellError variants to named fields (#11222)
# Description Convert errors to named fields: * NeedsPositiveValue * MissingConfigValue * UnsupportedConfigValue * DowncastNotPossible * NonUtf8Custom * NonUtf8 * DidYouMeanCustom * DidYouMean * ReadingFile * RemoveNotPossible * ChangedModifiedTimeNotPossible * ChangedAccessTimeNotPossible Part of #10700
This commit is contained in:
@ -82,12 +82,16 @@ impl Command for Du {
|
||||
let max_depth: Option<Spanned<i64>> = call.get_flag(engine_state, stack, "max-depth")?;
|
||||
if let Some(ref max_depth) = max_depth {
|
||||
if max_depth.item < 0 {
|
||||
return Err(ShellError::NeedsPositiveValue(max_depth.span));
|
||||
return Err(ShellError::NeedsPositiveValue {
|
||||
span: max_depth.span,
|
||||
});
|
||||
}
|
||||
}
|
||||
if let Some(ref min_size) = min_size {
|
||||
if min_size.item < 0 {
|
||||
return Err(ShellError::NeedsPositiveValue(min_size.span));
|
||||
return Err(ShellError::NeedsPositiveValue {
|
||||
span: min_size.span,
|
||||
});
|
||||
}
|
||||
}
|
||||
let current_dir = current_dir(engine_state, stack)?;
|
||||
|
Reference in New Issue
Block a user