Log HtmlConfig deserialization errors

This commit is contained in:
Tjeu Kayim 2019-09-22 14:27:14 +02:00
parent bb7a863d3e
commit db13d8e561
1 changed files with 8 additions and 1 deletions

View File

@ -62,6 +62,7 @@ use toml_query::insert::TomlValueInsertExt;
use toml_query::read::TomlValueReadExt; use toml_query::read::TomlValueReadExt;
use crate::errors::*; use crate::errors::*;
use crate::utils;
/// The overall configuration object for MDBook, essentially an in-memory /// The overall configuration object for MDBook, essentially an in-memory
/// representation of `book.toml`. /// representation of `book.toml`.
@ -168,7 +169,13 @@ impl Config {
/// HTML renderer is refactored to be less coupled to `mdbook` internals. /// HTML renderer is refactored to be less coupled to `mdbook` internals.
#[doc(hidden)] #[doc(hidden)]
pub fn html_config(&self) -> Option<HtmlConfig> { pub fn html_config(&self) -> Option<HtmlConfig> {
self.get_deserialized("output.html").ok() match self.get_deserialized("output.html") {
Ok(config) => Some(config),
Err(e) => {
utils::log_backtrace(&e.chain_err(|| "Parsing configuration [output.html]"));
None
}
}
} }
/// Convenience function to fetch a value from the config and deserialize it /// Convenience function to fetch a value from the config and deserialize it