mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 22:08:41 +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:
@@ -102,12 +102,12 @@ impl HashableValue {
|
||||
|
||||
// Explicitly propagate errors instead of dropping them.
|
||||
Value::Error { error, .. } => Err(*error),
|
||||
_ => Err(ShellError::UnsupportedInput(
|
||||
"input value is not hashable".into(),
|
||||
format!("input type: {:?}", value.get_type()),
|
||||
span,
|
||||
value.span(),
|
||||
)),
|
||||
_ => Err(ShellError::UnsupportedInput {
|
||||
msg: "input value is not hashable".into(),
|
||||
input: format!("input type: {:?}", value.get_type()),
|
||||
msg_span: span,
|
||||
input_span: value.span(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -162,14 +162,9 @@ fn run_histogram(
|
||||
let t = v.get_type();
|
||||
let span = v.span();
|
||||
inputs.push(HashableValue::from_value(v, head_span).map_err(|_| {
|
||||
ShellError::UnsupportedInput(
|
||||
"Since --column-name was not provided, only lists of hashable values are supported.".to_string(),
|
||||
format!(
|
||||
ShellError::UnsupportedInput { msg: "Since --column-name was not provided, only lists of hashable values are supported.".to_string(), input: format!(
|
||||
"input type: {t:?}"
|
||||
),
|
||||
head_span,
|
||||
span,
|
||||
)
|
||||
), msg_span: head_span, input_span: span }
|
||||
})?)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user