mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-28 12:01:06 -05:00
fix(cli): Improve error on missing config
This commit is contained in:
parent
03e6afbaa6
commit
e003ac8f1e
2 changed files with 8 additions and 2 deletions
|
@ -31,7 +31,13 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_file(path: &std::path::Path) -> Result<Self, anyhow::Error> {
|
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)
|
Self::from_toml(&s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,5 @@ status.code = 78
|
||||||
stdin = ""
|
stdin = ""
|
||||||
# stdout doesn't have stable order
|
# stdout doesn't have stable order
|
||||||
stderr = """
|
stderr = """
|
||||||
No such file or directory (os error 2)
|
could not read config at `foo.toml`
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue