diff --git a/crates/nu-cli/src/commands/headers.rs b/crates/nu-cli/src/commands/headers.rs index 295178f111..3d8526ff34 100644 --- a/crates/nu-cli/src/commands/headers.rs +++ b/crates/nu-cli/src/commands/headers.rs @@ -52,7 +52,7 @@ pub fn headers( } }).collect()) } - _ => Err(ShellError::untagged_runtime_error("Couldn't find all headers, was the input a properly formatted, non-empty table?")), + _ => Err(ShellError::unexpected_eof("Could not get headers, is the table empty?", rows[0].tag.span)) }?; //Each row is a dictionary with the headers as keys @@ -67,7 +67,7 @@ pub fn headers( } yield Ok(ReturnSuccess::Value(UntaggedValue::Row(Dictionary{entries}).into_value(r.tag.clone()))) } - _ => yield Err(ShellError::untagged_runtime_error("Couldn't iterate through rows, was the input a properly formatted table?")) + _ => yield Err(ShellError::unexpected_eof("Couldn't iterate through rows, was the input a properly formatted table?", r.tag.span)) } } }; diff --git a/crates/nu-cli/src/utils.rs b/crates/nu-cli/src/utils.rs index 0fddf91ff7..6653a80188 100644 --- a/crates/nu-cli/src/utils.rs +++ b/crates/nu-cli/src/utils.rs @@ -317,6 +317,10 @@ mod tests { loc: fixtures().join("sample_data.xlsx"), at: 0 }, + Res { + loc: fixtures().join("sample_headers.xlsx"), + at: 0 + }, Res { loc: fixtures().join("script.nu"), at: 0