mirror of
https://github.com/nushell/nushell.git
synced 2025-08-12 03:20: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:
@ -180,12 +180,12 @@ fn run(call: &Call, args: &Arguments, input: PipelineData) -> Result<PipelineDat
|
||||
metadata,
|
||||
)),
|
||||
PipelineData::Empty { .. } => Err(ShellError::PipelineEmpty { dst_span: head }),
|
||||
_ => Err(ShellError::UnsupportedInput(
|
||||
"Input value cannot be joined".to_string(),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
input.span().unwrap_or(call.head),
|
||||
)),
|
||||
_ => Err(ShellError::UnsupportedInput {
|
||||
msg: "Input value cannot be joined".to_string(),
|
||||
input: "value originates from here".into(),
|
||||
msg_span: head,
|
||||
input_span: input.span().unwrap_or(call.head),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,14 +249,9 @@ fn merge_record(record: &Record, head: Span, span: Span) -> Result<PathBuf, Shel
|
||||
for key in &record.cols {
|
||||
if !super::ALLOWED_COLUMNS.contains(&key.as_str()) {
|
||||
let allowed_cols = super::ALLOWED_COLUMNS.join(", ");
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
format!(
|
||||
return Err(ShellError::UnsupportedInput { msg: format!(
|
||||
"Column '{key}' is not valid for a structured path. Allowed columns on this platform are: {allowed_cols}"
|
||||
),
|
||||
"value originates from here".into(),
|
||||
head,
|
||||
span
|
||||
));
|
||||
), input: "value originates from here".into(), msg_span: head, input_span: span });
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user