path: fix error message (#6860)

Closes #6819
This commit is contained in:
nibon7 2022-10-22 19:42:46 +08:00 committed by GitHub
parent e3bf6fdfc0
commit ab0a6b6ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,16 @@ fn handle_invalid_values(rest: Value, name: Span) -> Value {
fn err_from_value(rest: &Value, name: Span) -> ShellError {
match rest.span() {
Ok(span) => ShellError::PipelineMismatch("string, row or list".into(), name, span),
Ok(span) => {
if rest.is_nothing() {
ShellError::UnsupportedInput(
"Input type is nothing, expected: string, row or list".into(),
name,
)
} else {
ShellError::PipelineMismatch("string, row or list".into(), name, span)
}
}
Err(error) => error,
}
}