mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 15:25:06 +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:
@ -36,12 +36,12 @@ pub fn from_ics_call(call: &EvaluatedCall, input: &Value) -> Result<Value, Label
|
||||
match calendar {
|
||||
Ok(c) => output.push(calendar_to_value(c, head)),
|
||||
Err(e) => output.push(Value::error(
|
||||
ShellError::UnsupportedInput(
|
||||
format!("input cannot be parsed as .ics ({e})"),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
span,
|
||||
),
|
||||
ShellError::UnsupportedInput {
|
||||
msg: format!("input cannot be parsed as .ics ({e})"),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: span,
|
||||
},
|
||||
span,
|
||||
)),
|
||||
}
|
||||
|
@ -40,12 +40,12 @@ pub fn from_ini_call(call: &EvaluatedCall, input: &Value) -> Result<Value, Label
|
||||
// all sections with all its key value pairs
|
||||
Ok(Value::record(sections, span))
|
||||
}
|
||||
Err(err) => Err(ShellError::UnsupportedInput(
|
||||
format!("Could not load ini: {err}"),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
span,
|
||||
)
|
||||
Err(err) => Err(ShellError::UnsupportedInput {
|
||||
msg: format!("Could not load ini: {err}"),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: span,
|
||||
}
|
||||
.into()),
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ pub fn from_vcf_call(call: &EvaluatedCall, input: &Value) -> Result<Value, Label
|
||||
let iter = parser.map(move |contact| match contact {
|
||||
Ok(c) => contact_to_value(c, head),
|
||||
Err(e) => Value::error(
|
||||
ShellError::UnsupportedInput(
|
||||
format!("input cannot be parsed as .vcf ({e})"),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
span,
|
||||
),
|
||||
ShellError::UnsupportedInput {
|
||||
msg: format!("input cannot be parsed as .vcf ({e})"),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: span,
|
||||
},
|
||||
span,
|
||||
),
|
||||
});
|
||||
|
Reference in New Issue
Block a user