summaryrefslogtreecommitdiff
path: root/src/metadata.rs
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2022-05-06 19:28:34 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2022-05-06 19:28:34 +0000
commit27b617cbaa9e6d4fb58a0b971b428a05da8ec5d9 (patch)
tree08067bf4290982e4a717ba55a660714084370158 /src/metadata.rs
parentc2cbccd45a2c356e458abc8bbef3193434e8572a (diff)
parent52ccfa5a1bf2893bdc63ff1bad2b2a88ca86ef95 (diff)
downloadsubplot-27b617cbaa9e6d4fb58a0b971b428a05da8ec5d9.tar.gz
Merge branch 'liw/tidy-up-error' into 'main'
tidy up error handling a bit See merge request subplot/subplot!275
Diffstat (limited to 'src/metadata.rs')
-rw-r--r--src/metadata.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/metadata.rs b/src/metadata.rs
index 0248891..5f5e183 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -1,5 +1,4 @@
-use crate::Result;
-use crate::{Bindings, TemplateSpec};
+use crate::{Bindings, SubplotError, TemplateSpec};
use std::collections::HashMap;
use std::fmt::Debug;
@@ -31,7 +30,11 @@ pub struct DocumentImpl {
impl Metadata {
/// Construct a Metadata from a Document, if possible.
- pub fn new<P>(basedir: P, doc: &Pandoc, template: Option<&str>) -> Result<Metadata>
+ pub fn new<P>(
+ basedir: P,
+ doc: &Pandoc,
+ template: Option<&str>,
+ ) -> Result<Metadata, SubplotError>
where
P: AsRef<Path> + Debug,
{
@@ -152,7 +155,7 @@ fn get_bindings_filenames(map: &Mapp) -> Vec<PathBuf> {
get_paths("", map, "bindings")
}
-fn load_template_spec(template: &str) -> Result<TemplateSpec> {
+fn load_template_spec(template: &str) -> Result<TemplateSpec, SubplotError> {
let mut spec_path = PathBuf::from(template);
spec_path.push("template");
spec_path.push("template.yaml");
@@ -298,7 +301,11 @@ mod test_join {
}
}
-fn get_bindings<P>(filenames: &[P], bindings: &mut Bindings, template: Option<&str>) -> Result<()>
+fn get_bindings<P>(
+ filenames: &[P],
+ bindings: &mut Bindings,
+ template: Option<&str>,
+) -> Result<(), SubplotError>
where
P: AsRef<Path> + Debug,
{