mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 10:08:21 +02:00
Convert ShellError::UnsupportedInput to named fields (#10971)
# Description This is easy to do with rust-analyzer, but I didn't want to just pump these all out without feedback. Part of #10700 # User-Facing Changes None # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A --------- Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
@ -73,12 +73,12 @@ impl Command for Input {
|
||||
});
|
||||
|
||||
if numchar.item < 1 {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
"Number of characters to read has to be positive".to_string(),
|
||||
"value originated from here".to_string(),
|
||||
call.head,
|
||||
numchar.span,
|
||||
));
|
||||
return Err(ShellError::UnsupportedInput {
|
||||
msg: "Number of characters to read has to be positive".to_string(),
|
||||
input: "value originated from here".to_string(),
|
||||
msg_span: call.head,
|
||||
input_span: numchar.span,
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(prompt) = &prompt {
|
||||
|
@ -178,21 +178,21 @@ impl EventTypeFilter {
|
||||
}
|
||||
|
||||
fn wrong_type_error(head: Span, val: &str, val_span: Span) -> ShellError {
|
||||
ShellError::UnsupportedInput(
|
||||
format!("{} is not a valid event type", val),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
val_span,
|
||||
)
|
||||
ShellError::UnsupportedInput {
|
||||
msg: format!("{} is not a valid event type", val),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: val_span,
|
||||
}
|
||||
}
|
||||
|
||||
fn bad_list_error(head: Span, value: &Value) -> ShellError {
|
||||
ShellError::UnsupportedInput(
|
||||
"--types expects a list of strings".to_string(),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
value.span(),
|
||||
)
|
||||
ShellError::UnsupportedInput {
|
||||
msg: "--types expects a list of strings".to_string(),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: value.span(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Enable capturing of all events allowed by this filter.
|
||||
|
Reference in New Issue
Block a user