mirror of
https://github.com/nushell/nushell
synced 2025-01-26 11:55:20 +00:00
Change ShellError for headers, Add sample_headers file to utils.rs
This commit is contained in:
parent
088561f6fe
commit
4cb3a6ecd7
2 changed files with 6 additions and 2 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue