summaryrefslogtreecommitdiff
path: root/src/bindings.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-05-06 09:42:14 +0300
committerLars Wirzenius <liw@liw.fi>2022-05-06 09:42:14 +0300
commit185377775aeeba57f91d6b40a8a599e840db1e90 (patch)
treed15fc0baf5926ab3bafef2bf6f9271751289d229 /src/bindings.rs
parentf42f4b2c27af2041436d681e4e292e549985066c (diff)
downloadsubplot-185377775aeeba57f91d6b40a8a599e840db1e90.tar.gz
refactor: replace SubplotError::RegexError with a simpler one
SubplotError::RegexError was a struct variant in the enum. Replace it with a more usual variant with the regex::Error as a source field, for better error messaging. Sponsored-by: author
Diffstat (limited to 'src/bindings.rs')
-rw-r--r--src/bindings.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bindings.rs b/src/bindings.rs
index a6f96ca..5db63c9 100644
--- a/src/bindings.rs
+++ b/src/bindings.rs
@@ -171,7 +171,8 @@ impl Binding {
) -> Result<Binding, SubplotError> {
let regex = RegexBuilder::new(&format!("^{}$", pattern))
.case_insensitive(!case_sensitive)
- .build()?;
+ .build()
+ .map_err(|err| SubplotError::Regex(pattern.to_string(), err))?;
// For every named capture, ensure we have a known type for it.
// If the type is missing from the map, we default to `text` which is
// the .* pattern