src/section_config.rs - write: improve error message

This commit is contained in:
Dietmar Maurer 2020-01-14 12:02:25 +01:00
parent f51420ba1f
commit 4566303b05
1 changed files with 52 additions and 50 deletions

View File

@ -113,8 +113,9 @@ impl SectionConfig {
self.plugins.insert(plugin.type_name.clone(), plugin); self.plugins.insert(plugin.type_name.clone(), plugin);
} }
pub fn write(&self, _filename: &str, config: &SectionConfigData) -> Result<String, Error> { pub fn write(&self, filename: &str, config: &SectionConfigData) -> Result<String, Error> {
try_block!({
let mut list = VecDeque::new(); let mut list = VecDeque::new();
let mut done = HashSet::new(); let mut done = HashSet::new();
@ -173,6 +174,7 @@ impl SectionConfig {
} }
Ok(raw) Ok(raw)
}).map_err(|e: Error| format_err!("writing '{}' failed: {}", filename, e))
} }
pub fn parse(&self, filename: &str, raw: &str) -> Result<SectionConfigData, Error> { pub fn parse(&self, filename: &str, raw: &str) -> Result<SectionConfigData, Error> {