diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-01-17 06:20:25 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-01-17 06:20:25 +0000 |
commit | 6fa225df872ea63ddeffbc017f30c0eb96feb8ce (patch) | |
tree | c0c9080d79bf5cc9972b50a562e31ba822abbe05 /src/client.rs | |
parent | 6d53680f71d7d88bb9498c75db95bfb1408c6fc7 (diff) | |
parent | 06b5606f13592b669212a97fb5ea3367d7f0fa21 (diff) | |
download | obnam2-6fa225df872ea63ddeffbc017f30c0eb96feb8ce.tar.gz |
Merge branch 'default-config-file' into 'main'
feat: add a default configuration file
Closes #45
See merge request larswirzenius/obnam!67
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client.rs b/src/client.rs index 4526830..23df540 100644 --- a/src/client.rs +++ b/src/client.rs @@ -9,6 +9,7 @@ use crate::fsentry::{FilesystemEntry, FilesystemKind}; use crate::generation::{FinishedGeneration, LocalGeneration}; use crate::genlist::GenerationList; +use anyhow::Context; use chrono::{DateTime, Local}; use log::{debug, error, info, trace}; use reqwest::blocking::Client; @@ -28,7 +29,8 @@ pub struct ClientConfig { impl ClientConfig { pub fn read_config(filename: &Path) -> anyhow::Result<Self> { trace!("read_config: filename={:?}", filename); - let config = std::fs::read_to_string(filename)?; + let config = std::fs::read_to_string(filename) + .with_context(|| format!("reading configuration file {}", filename.display()))?; let config = serde_yaml::from_str(&config)?; Ok(config) } |