From ab0a6b6ca6a07ca12a0bf4273838ed5db31539fc Mon Sep 17 00:00:00 2001 From: nibon7 Date: Sat, 22 Oct 2022 19:42:46 +0800 Subject: [PATCH] path: fix error message (#6860) Closes #6819 --- crates/nu-command/src/path/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/path/mod.rs b/crates/nu-command/src/path/mod.rs index 5d194153cc..a27543d0bd 100644 --- a/crates/nu-command/src/path/mod.rs +++ b/crates/nu-command/src/path/mod.rs @@ -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, } }