Skip to content

Improve CLI error messages associated with opening train/test file #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn main() {
Subcommand::Serve(args) => self::serve::serve(*args),
};
if let Err(error) = result {
eprintln!("{}: {}", "error".red().bold(), error);
eprintln!("{}: {:#}", "error".red().bold(), error);
std::process::exit(1);
}
}
Expand Down
6 changes: 4 additions & 2 deletions crates/table/load.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use anyhow::Result;
use anyhow::{Context, Result};
use std::{
collections::{BTreeMap, BTreeSet},
path::Path,
Expand Down Expand Up @@ -71,7 +71,9 @@ impl Table {
options: FromCsvOptions,
handle_progress_event: &mut impl FnMut(LoadProgressEvent),
) -> Result<Table> {
let len = std::fs::metadata(path)?.len();
let len = std::fs::metadata(path)
.with_context(|| format!("Unable to open the input file \"{}\"", path.display()))?
.len();
Table::from_csv(
&mut csv::Reader::from_path(path)?,
len,
Expand Down