fix(cli): Improve error on missing config

This commit is contained in:
Ed Page 2023-08-18 16:08:25 -05:00
parent 03e6afbaa6
commit e003ac8f1e
2 changed files with 8 additions and 2 deletions

View file

@ -31,7 +31,13 @@ impl Config {
}
pub fn from_file(path: &std::path::Path) -> Result<Self, anyhow::Error> {
let s = std::fs::read_to_string(path)?;
let s = std::fs::read_to_string(path).map_err(|err| {
let kind = err.kind();
std::io::Error::new(
kind,
format!("could not read config at `{}`", path.display()),
)
})?;
Self::from_toml(&s)
}

View file

@ -4,5 +4,5 @@ status.code = 78
stdin = ""
# stdout doesn't have stable order
stderr = """
No such file or directory (os error 2)
could not read config at `foo.toml`
"""