[librsvg: 11/51] parsers.rs: Don't create a NodeError directly
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 11/51] parsers.rs: Don't create a NodeError directly
- Date: Thu, 19 Dec 2019 01:48:56 +0000 (UTC)
commit 302eb3d482f20b17c0bd572ab707386a815a84a1
Author: Federico Mena Quintero <federico gnome org>
Date: Tue Dec 17 10:44:37 2019 -0600
parsers.rs: Don't create a NodeError directly
rsvg_internals/src/parsers.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index 765afb4b..3d5b4605 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -5,7 +5,7 @@ use markup5ever::QualName;
use std::str;
-use crate::error::{NodeError, ValueErrorKind};
+use crate::error::*;
/// Trait to parse values using `cssparser::Parser`.
pub trait Parse: Sized {
@@ -73,7 +73,7 @@ impl<T: Parse> ParseValue<T> for QualName {
let mut input = ParserInput::new(value);
let mut parser = Parser::new(&mut input);
- T::parse(&mut parser).map_err(|e| NodeError::new(self.clone(), e))
+ T::parse(&mut parser).attribute(self.clone())
}
fn parse_and_validate<F: FnOnce(T) -> Result<T, ValueErrorKind>>(
@@ -84,9 +84,7 @@ impl<T: Parse> ParseValue<T> for QualName {
let mut input = ParserInput::new(value);
let mut parser = Parser::new(&mut input);
- T::parse(&mut parser)
- .and_then(validate)
- .map_err(|e| NodeError::new(self.clone(), e))
+ T::parse(&mut parser).and_then(validate).attribute(self.clone())
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]