Skip to content

Commit

Permalink
add path info when error opening file
Browse files Browse the repository at this point in the history
  • Loading branch information
rikkaka committed Jul 25, 2023
1 parent 700b965 commit 2238522
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion polars/polars-lazy/polars-plan/src/logical_plan/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,12 @@ impl LogicalPlanBuilder {
try_parse_dates: bool,
) -> PolarsResult<Self> {
let path = path.into();
let mut file = std::fs::File::open(&path)?;
let mut file = std::fs::File::open(&path).map_err(|e| {
polars_err!(
Io: "error open file: '{:?}', {:?}",
path, e
)
})?;
let mut magic_nr = [0u8; 2];
file.read_exact(&mut magic_nr)
.map_err(|_| polars_err!(NoData: "empty csv"))?;
Expand Down

0 comments on commit 2238522

Please sign in to comment.