diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/doc.rs | 3 | ||||
-rw-r--r-- | src/error.rs | 9 |
2 files changed, 12 insertions, 0 deletions
@@ -559,6 +559,9 @@ pub fn codegen(filename: &Path, output: &Path, template: Option<&str>) -> Result .unwrap_or_else(|| doc.template())? .to_string(); event!(Level::TRACE, ?template); + if !doc.meta().templates().any(|t| t == template) { + return Err(SubplotError::TemplateSupportNotPresent); + } if !doc.check_named_files_exist(&template)? || !doc.check_matched_steps_have_impl(&template) || !doc.check_embedded_files_are_used(&template)? diff --git a/src/error.rs b/src/error.rs index ec88733..bcee4ff 100644 --- a/src/error.rs +++ b/src/error.rs @@ -125,6 +125,15 @@ pub enum SubplotError { #[error("document has more than one template possibility")] AmbiguousTemplate, + /// Document does not support the requested template + /// + /// The document YAML metadata does not specify support for the + /// stated template. + /// + /// To fix, specify a template which is provided for in the document. + #[error("document lacks specified template support")] + TemplateSupportNotPresent, + /// Pandoc AST is not JSON /// /// Subplot acts as a Pandoc filter, and as part of that Pandoc |