[renderer] Err on bad file names, instead of panic
Addressing the review comments.
This commit is contained in:
parent
99945542ca
commit
ddee839d9c
2
build.rs
2
build.rs
|
@ -25,8 +25,6 @@ mod execs {
|
|||
}
|
||||
|
||||
|
||||
// TODO: Drop after error_chain is fixed
|
||||
#[allow(unused_doc_comment)]
|
||||
error_chain!{
|
||||
foreign_links {
|
||||
Io(std::io::Error);
|
||||
|
|
|
@ -100,8 +100,6 @@ pub use book::BookItem;
|
|||
pub use renderer::Renderer;
|
||||
|
||||
/// The error types used through out this crate.
|
||||
// TODO: Drop after error_chain is fixed
|
||||
#[allow(unused_doc_comment)]
|
||||
pub mod errors {
|
||||
error_chain!{
|
||||
foreign_links {
|
||||
|
|
|
@ -66,8 +66,9 @@ impl HtmlHandlebars {
|
|||
let filepath = Path::new(&ch.path).with_extension("html");
|
||||
let rendered = self.post_process(rendered,
|
||||
&normalize_path(filepath.to_str()
|
||||
.expect(&format!("Bad file name: {}", filepath.display()))),
|
||||
ctx.book.get_html_config().get_playpen_config());
|
||||
.ok_or(Error::from(format!("Bad file name: {}", filepath.display())))?),
|
||||
ctx.book.get_html_config().get_playpen_config()
|
||||
);
|
||||
|
||||
// Write to file
|
||||
info!("[*] Creating {:?} ✓", filepath.display());
|
||||
|
@ -458,7 +459,7 @@ fn id_from_content(content: &str) -> String {
|
|||
let mut content = content.to_string();
|
||||
|
||||
// Skip any tags or html-encoded stuff
|
||||
static REPL_SUB: &[&str] = &[
|
||||
const REPL_SUB: &[&str] = &[
|
||||
"<em>",
|
||||
"</em>",
|
||||
"<code>",
|
||||
|
|
Loading…
Reference in New Issue