diff --git a/src/config/jsonconfig.rs b/src/config/jsonconfig.rs index f41f8763..904787c0 100644 --- a/src/config/jsonconfig.rs +++ b/src/config/jsonconfig.rs @@ -1,5 +1,6 @@ extern crate serde_json; use std::path::PathBuf; +use errors::*; /// The JSON configuration is **deprecated** and will be removed in the near future. /// Please migrate to the TOML configuration. @@ -32,9 +33,9 @@ pub struct JsonConfig { /// assert_eq!(config.dest, Some(PathBuf::from("htmlbook"))); /// ``` impl JsonConfig { - pub fn from_json(input: &str) -> Result { + pub fn from_json(input: &str) -> Result { let config: JsonConfig = serde_json::from_str(input) - .map_err(|e| format!("Could not parse JSON: {}", e))?; + .chain_err(|| format!("Could not parse JSON"))?; return Ok(config); } diff --git a/src/config/tomlconfig.rs b/src/config/tomlconfig.rs index 90cfa4c6..9c6851c5 100644 --- a/src/config/tomlconfig.rs +++ b/src/config/tomlconfig.rs @@ -1,5 +1,6 @@ extern crate toml; use std::path::PathBuf; +use errors::*; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct TomlConfig { @@ -43,9 +44,9 @@ pub struct TomlHtmlConfig { /// assert_eq!(config.output.unwrap().html.unwrap().destination, Some(PathBuf::from("htmlbook"))); /// ``` impl TomlConfig { - pub fn from_toml(input: &str) -> Result { + pub fn from_toml(input: &str) -> Result { let config: TomlConfig = toml::from_str(input) - .map_err(|e| format!("Could not parse TOML: {}", e))?; + .chain_err(|| "Could not parse TOML")?; return Ok(config); }