Print pandoc error rather than panic-ing (#382)

* Print pandoc error rather than panic-ing

* Maintain current failing behaviour

* Update export.rs
This commit is contained in:
Yannik Sander 2021-12-06 18:23:10 +01:00 committed by GitHub
parent 46d00f3b43
commit d0f0b84eea
Failed to generate hash of commit

View file

@ -4,7 +4,8 @@
use std::path::PathBuf;
use crate::data::import::NixOption;
use pandoc::{InputFormat, InputKind, OutputFormat, OutputKind, PandocOption, PandocOutput};
use log::error;
use pandoc::{InputFormat, InputKind, OutputFormat, OutputKind, PandocOption, PandocOutput, PandocError};
use serde::{Deserialize, Serialize};
use super::{
@ -315,7 +316,8 @@ impl From<import::NixOption> for Derivation {
PandocOption::LuaFilter(man_filter),
]);
let result = pandoc.execute().unwrap();
let result = pandoc.execute().expect(&format!("Pandoc could not parse documentation of '{}'", name));
match result {
PandocOutput::ToBuffer(description) => Some(description),
_ => unreachable!(),