mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-12 05:32:09 +08:00
fix(logging): include paths in file failure logs
This commit is contained in:
@@ -16,9 +16,13 @@ pub async fn read_yaml<T: DeserializeOwned>(path: &Path) -> Result<T> {
|
||||
bail!("file not found \"{}\"", path.display());
|
||||
}
|
||||
|
||||
let yaml_str = tokio::fs::read_to_string(path).await?;
|
||||
let yaml_str = tokio::fs::read_to_string(path)
|
||||
.await
|
||||
.with_context(|| format!("failed to read YAML file {}", path.display()))?;
|
||||
|
||||
Ok(with_encryption(|| async { serde_yaml_ng::from_str::<T>(&yaml_str) }).await?)
|
||||
with_encryption(|| async { serde_yaml_ng::from_str::<T>(&yaml_str) })
|
||||
.await
|
||||
.with_context(|| format!("failed to parse YAML file {}", path.display()))
|
||||
}
|
||||
|
||||
pub async fn read_mapping(path: &Path) -> Result<Mapping> {
|
||||
|
||||
Reference in New Issue
Block a user