diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-05-06 09:30:27 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-05-06 09:34:28 +0300 |
commit | f42f4b2c27af2041436d681e4e292e549985066c (patch) | |
tree | 3f689eaee73afa054ccb86de9c5544c8263f97c1 /src/bindings.rs | |
parent | 2a452b2d2f4fba6f840e2ea33123002ae58e88b2 (diff) | |
download | subplot-f42f4b2c27af2041436d681e4e292e549985066c.tar.gz |
refactor: replace SubplotError::YamlError with more specific one
SubplotError::YamlError is quite generic. We only parse YAML as part
of document metadata, so replace the error with a more specific one.
Sponsored-by: author
Diffstat (limited to 'src/bindings.rs')
-rw-r--r-- | src/bindings.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bindings.rs b/src/bindings.rs index 5c98297..a6f96ca 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -463,7 +463,8 @@ impl Bindings { /// Add bindings from a YAML string pub fn add_from_yaml(&mut self, yaml: &str) -> Result<(), SubplotError> { - let bindings: Vec<ParsedBindingWrapper> = serde_yaml::from_str(yaml)?; + let bindings: Vec<ParsedBindingWrapper> = + serde_yaml::from_str(yaml).map_err(SubplotError::Metadata)?; for wrapper in bindings { self.add(from_hashmap(&wrapper.binding)?); } |