Verified Commit f6137e18 authored by Daniel Silverstone's avatar Daniel Silverstone 🇺🇦
Browse files

bindings: Example chained error for parsing bindings


Signed-off-by: Daniel Silverstone's avatarDaniel Silverstone <dsilvers@digital-scurf.org>
parent 61401404
......@@ -513,7 +513,9 @@ impl Bindings {
let yaml = resource::read_as_string(filename.as_ref())
.map_err(|e| SubplotError::BindingsFileNotFound(filename.as_ref().into(), e))?;
event!(Level::TRACE, "Loaded file content");
self.add_from_yaml(&yaml)?;
self.add_from_yaml(&yaml).map_err(|e| {
SubplotError::BindingFileParseError(filename.as_ref().to_owned(), Box::new(e))
})?;
Ok(())
}
......
......@@ -36,6 +36,10 @@ pub enum SubplotError {
#[error("simple pattern contains regex metacharacters: {0}")]
SimplePatternHasMetaCharacters(String),
/// Error while parsing a bindings file
#[error("binding file failed to parse: {0}")]
BindingFileParseError(PathBuf, #[source] Box<SubplotError>),
/// Scenario step does not match a known binding
///
/// This may be due to the binding missing entirely, or that the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment