mirror of
https://github.com/crate-ci/typos.git
synced 2026-11-29 08:17:46 +01:00
fix(cli): Improve error on missing config
This commit is contained in:
1 parent
03e6afbaa6
commit
e003ac8f1e
2 files changed
+8
-2
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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`
|
||||
"""
|
||||
Reference in new issue
Block a user