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:
Eric Hodel
2023-12-04 01:19:32 -08:00
committed by GitHub
parent b227eea668
commit 67eec92e76
26 changed files with 299 additions and 208 deletions

View File

@ -302,16 +302,16 @@ impl UrlComponents {
return Ok(true);
}
match key {
"host" => Err(ShellError::UnsupportedConfigValue(
"non-empty string".into(),
"empty string".into(),
value_span,
)),
"scheme" => Err(ShellError::UnsupportedConfigValue(
"non-empty string".into(),
"empty string".into(),
value_span,
)),
"host" => Err(ShellError::UnsupportedConfigValue {
expected: "non-empty string".into(),
value: "empty string".into(),
span: value_span,
}),
"scheme" => Err(ShellError::UnsupportedConfigValue {
expected: "non-empty string".into(),
value: "empty string".into(),
span: value_span,
}),
_ => Ok(false),
}
}