[librsvg] Rename AttributeError to ValueErrorKind



commit 7e629ca96bd8ad4a5029e13c72e8b8537c567631
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Sep 14 09:24:55 2018 -0500

    Rename AttributeError to ValueErrorKind
    
    Our terminology for errors is slightly wrong, and it doesn't quite
    match the model that rust-cssparser and servo expect.
    
    Rust-cssparser provides BasicParseError, which is a
    BasicParseErrorKind plus a location.  This is just a simple parsing
    error like "unexpected token" or "premature EOF".
    
    On top of that, rust-cssparser provides ParseError and ParseErrorKind.
    The former is a ParseErrorKind plus a location; the latter is a basic
    parse error, or a custom error.
    
    When implementing the rules_and_declarations traits, cssparser expects
    us to provide our own custom parsing errors in the form of
    ParseError<OurCustomError>.  For example, Servo has this:
    
      pub type ParseError<'i> = cssparser::ParseError<'i, StyleParseErrorKind<'i>>;
    
    And that StyleParseErrorKind has a ton of stuff:
    
      pub enum StyleParseErrorKind<'i> {
          BadUrlInDeclarationValueBlock(CowRcStr<'i>),
          BadStringInDeclarationValueBlock(CowRcStr<'i>),
          UnbalancedCloseParenthesisInDeclarationValueBlock,
          UnbalancedCloseSquareBracketInDeclarationValueBlock,
          UnbalancedCloseCurlyBracketInDeclarationValueBlock,
          PropertyDeclarationValueNotExhausted,
          UnexpectedDimension(CowRcStr<'i>),
          ...
      }
    
    So, we will move to a similar model.
    
    AttributeError is the wrong name; it represents a parsing or
    validation error in a value from an element attribute, or a CSS style
    property... but we don't know which.  Instead, we'll call it
    ValueErrorKind, to make it closer to rust-cssparser's view of the world.

 rsvg_internals/src/aspect_ratio.rs      |  6 ++--
 rsvg_internals/src/color.rs             | 18 ++++++------
 rsvg_internals/src/cond.rs              |  6 ++--
 rsvg_internals/src/coord_units.rs       | 12 ++++----
 rsvg_internals/src/error.rs             | 38 ++++++++++++-------------
 rsvg_internals/src/filters/composite.rs |  6 ++--
 rsvg_internals/src/filters/mod.rs       |  4 +--
 rsvg_internals/src/filters/node.rs      |  4 +--
 rsvg_internals/src/font_props.rs        | 24 ++++++++--------
 rsvg_internals/src/gradient.rs          |  6 ++--
 rsvg_internals/src/length.rs            | 26 ++++++++---------
 rsvg_internals/src/marker.rs            | 22 +++++++--------
 rsvg_internals/src/paint_server.rs      |  6 ++--
 rsvg_internals/src/parsers.rs           | 20 ++++++-------
 rsvg_internals/src/property_macros.rs   | 16 +++++------
 rsvg_internals/src/state.rs             | 16 +++++------
 rsvg_internals/src/stop.rs              |  4 +--
 rsvg_internals/src/transform.rs         | 50 ++++++++++++++++-----------------
 rsvg_internals/src/unitinterval.rs      |  6 ++--
 rsvg_internals/src/viewbox.rs           |  6 ++--
 20 files changed, 148 insertions(+), 148 deletions(-)
---
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index f851986a..1b31adc6 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -211,11 +211,11 @@ impl FitMode {
 
 impl Parse for AspectRatio {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<AspectRatio, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<AspectRatio, ValueErrorKind> {
         AspectRatio::parse_input(parser).map_err(|_| {
-            AttributeError::Parse(ParseError::new(
+            ValueErrorKind::Parse(ParseError::new(
                 "expected \"[defer] <align> [meet | slice]\"",
             ))
         })
diff --git a/rsvg_internals/src/color.rs b/rsvg_internals/src/color.rs
index a43e38a3..c014f1e9 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -10,31 +10,31 @@ pub use cssparser::Color;
 
 impl Parse for cssparser::Color {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<cssparser::Color, AttributeError> {
+    ) -> Result<cssparser::Color, ValueErrorKind> {
         cssparser::Color::parse(parser)
-            .map_err(|_| AttributeError::Parse(ParseError::new("invalid syntax for color")))
+            .map_err(|_| ValueErrorKind::Parse(ParseError::new("invalid syntax for color")))
     }
 }
 
 impl Parse for cssparser::RGBA {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<cssparser::RGBA, AttributeError> {
+    ) -> Result<cssparser::RGBA, ValueErrorKind> {
         match cssparser::Color::parse(parser) {
             Ok(cssparser::Color::RGBA(rgba)) => Ok(rgba),
-            Ok(cssparser::Color::CurrentColor) => Err(AttributeError::Value(
+            Ok(cssparser::Color::CurrentColor) => Err(ValueErrorKind::Value(
                 "currentColor is not allowed here".to_string(),
             )),
-            _ => Err(AttributeError::Parse(ParseError::new(
+            _ => Err(ValueErrorKind::Parse(ParseError::new(
                 "invalid syntax for color",
             ))),
         }
@@ -79,8 +79,8 @@ pub fn rgba_to_argb(rgba: cssparser::RGBA) -> u32 {
         | u32::from(rgba.blue)
 }
 
-impl From<Result<Option<cssparser::Color>, AttributeError>> for ColorSpec {
-    fn from(result: Result<Option<cssparser::Color>, AttributeError>) -> ColorSpec {
+impl From<Result<Option<cssparser::Color>, ValueErrorKind>> for ColorSpec {
+    fn from(result: Result<Option<cssparser::Color>, ValueErrorKind>) -> ColorSpec {
         match result {
             Ok(None) => ColorSpec {
                 kind: ColorKind::Inherit,
diff --git a/rsvg_internals/src/cond.rs b/rsvg_internals/src/cond.rs
index a21f7c3e..b5fd9dad 100644
--- a/rsvg_internals/src/cond.rs
+++ b/rsvg_internals/src/cond.rs
@@ -13,7 +13,7 @@ pub struct RequiredExtensions(pub bool);
 impl RequiredExtensions {
     // Parse a requiredExtensions attribute
     // http://www.w3.org/TR/SVG/struct.html#RequiredExtensionsAttribute
-    pub fn from_attribute(s: &str) -> Result<RequiredExtensions, AttributeError> {
+    pub fn from_attribute(s: &str) -> Result<RequiredExtensions, ValueErrorKind> {
         Ok(RequiredExtensions(
             s.split_whitespace()
                 .all(|f| IMPLEMENTED_EXTENSIONS.binary_search(&f).is_ok()),
@@ -52,7 +52,7 @@ pub struct RequiredFeatures(pub bool);
 impl RequiredFeatures {
     // Parse a requiredFeatures attribute
     // http://www.w3.org/TR/SVG/struct.html#RequiredFeaturesAttribute
-    pub fn from_attribute(s: &str) -> Result<RequiredFeatures, AttributeError> {
+    pub fn from_attribute(s: &str) -> Result<RequiredFeatures, ValueErrorKind> {
         Ok(RequiredFeatures(
             s.split_whitespace()
                 .all(|f| IMPLEMENTED_FEATURES.binary_search(&f).is_ok()),
@@ -69,7 +69,7 @@ impl<'a> SystemLanguage<'a> {
     pub fn from_attribute(
         s: &str,
         system_languages: &[String],
-    ) -> Result<SystemLanguage<'a>, AttributeError> {
+    ) -> Result<SystemLanguage<'a>, ValueErrorKind> {
         Ok(SystemLanguage(
             s.split(',')
                 .map(|s| s.trim())
diff --git a/rsvg_internals/src/coord_units.rs b/rsvg_internals/src/coord_units.rs
index 0896b831..2e4ed8ea 100644
--- a/rsvg_internals/src/coord_units.rs
+++ b/rsvg_internals/src/coord_units.rs
@@ -1,6 +1,6 @@
 use cssparser::{CowRcStr, Parser, Token};
 
-use error::AttributeError;
+use error::ValueErrorKind;
 use parsers::{Parse, ParseError};
 
 /// Defines the units to be used for things that can consider a
@@ -17,9 +17,9 @@ pub enum CoordUnits {
 
 impl Parse for CoordUnits {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<CoordUnits, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<CoordUnits, ValueErrorKind> {
         let loc = parser.current_source_location();
 
         parser
@@ -33,7 +33,7 @@ impl Parse for CoordUnits {
                     ))),
                 ),
             }).map_err(|_| {
-                AttributeError::Parse(ParseError::new(
+                ValueErrorKind::Parse(ParseError::new(
                     "expected 'userSpaceOnUse' or 'objectBoundingBox'",
                 ))
             })
@@ -68,12 +68,12 @@ macro_rules! coord_units {
 
         impl $crate::parsers::Parse for $name {
             type Data = ();
-            type Err = $crate::error::AttributeError;
+            type Err = $crate::error::ValueErrorKind;
 
             fn parse(
                 parser: &mut ::cssparser::Parser<'_, '_>,
                 _: (),
-            ) -> Result<Self, $crate::error::AttributeError> {
+            ) -> Result<Self, $crate::error::ValueErrorKind> {
                 Ok($name($crate::coord_units::CoordUnits::parse(parser, ())?))
             }
         }
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index e4f68fec..0e3df141 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -9,7 +9,7 @@ use parsers::ParseError;
 
 /// A simple error which refers to an attribute's value
 #[derive(Debug, Clone, PartialEq)]
-pub enum AttributeError {
+pub enum ValueErrorKind {
     /// The value could not be parsed
     Parse(ParseError),
 
@@ -21,25 +21,25 @@ pub enum AttributeError {
 #[derive(Debug, Clone, PartialEq)]
 pub struct NodeError {
     attr: Attribute,
-    err: AttributeError,
+    err: ValueErrorKind,
 }
 
 impl NodeError {
     pub fn parse_error(attr: Attribute, error: ParseError) -> NodeError {
         NodeError {
             attr,
-            err: AttributeError::Parse(error),
+            err: ValueErrorKind::Parse(error),
         }
     }
 
     pub fn value_error(attr: Attribute, description: &str) -> NodeError {
         NodeError {
             attr,
-            err: AttributeError::Value(description.to_string()),
+            err: ValueErrorKind::Value(description.to_string()),
         }
     }
 
-    pub fn attribute_error(attr: Attribute, error: AttributeError) -> NodeError {
+    pub fn attribute_error(attr: Attribute, error: ValueErrorKind) -> NodeError {
         NodeError { attr, err: error }
     }
 }
@@ -47,8 +47,8 @@ impl NodeError {
 impl error::Error for NodeError {
     fn description(&self) -> &str {
         match self.err {
-            AttributeError::Parse(_) => "parse error",
-            AttributeError::Value(_) => "invalid attribute value",
+            ValueErrorKind::Parse(_) => "parse error",
+            ValueErrorKind::Value(_) => "invalid attribute value",
         }
     }
 }
@@ -56,14 +56,14 @@ impl error::Error for NodeError {
 impl fmt::Display for NodeError {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self.err {
-            AttributeError::Parse(ref n) => write!(
+            ValueErrorKind::Parse(ref n) => write!(
                 f,
                 "error parsing value for attribute \"{}\": {}",
                 self.attr.to_string(),
                 n.display
             ),
 
-            AttributeError::Value(ref s) => write!(
+            ValueErrorKind::Value(ref s) => write!(
                 f,
                 "invalid value for attribute \"{}\": {}",
                 self.attr.to_string(),
@@ -73,15 +73,15 @@ impl fmt::Display for NodeError {
     }
 }
 
-impl From<ParseError> for AttributeError {
-    fn from(pe: ParseError) -> AttributeError {
-        AttributeError::Parse(pe)
+impl From<ParseError> for ValueErrorKind {
+    fn from(pe: ParseError) -> ValueErrorKind {
+        ValueErrorKind::Parse(pe)
     }
 }
 
-impl<'a> From<BasicParseError<'a>> for AttributeError {
-    fn from(e: BasicParseError<'_>) -> AttributeError {
-        AttributeError::from(ParseError::from(e))
+impl<'a> From<BasicParseError<'a>> for ValueErrorKind {
+    fn from(e: BasicParseError<'_>) -> ValueErrorKind {
+        ValueErrorKind::from(ParseError::from(e))
     }
 }
 
@@ -101,17 +101,17 @@ impl From<cairo::Status> for RenderingError {
 }
 
 #[cfg(test)]
-pub fn is_parse_error<T>(r: &Result<T, AttributeError>) -> bool {
+pub fn is_parse_error<T>(r: &Result<T, ValueErrorKind>) -> bool {
     match *r {
-        Err(AttributeError::Parse(_)) => true,
+        Err(ValueErrorKind::Parse(_)) => true,
         _ => false,
     }
 }
 
 #[cfg(test)]
-pub fn is_value_error<T>(r: &Result<T, AttributeError>) -> bool {
+pub fn is_value_error<T>(r: &Result<T, ValueErrorKind>) -> bool {
     match *r {
-        Err(AttributeError::Value(_)) => true,
+        Err(ValueErrorKind::Value(_)) => true,
         _ => false,
     }
 }
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index 09652baf..d8586740 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -5,7 +5,7 @@ use cssparser::{CowRcStr, Parser, Token};
 
 use attributes::Attribute;
 use drawing_ctx::DrawingCtx;
-use error::{AttributeError, NodeError};
+use error::{NodeError, ValueErrorKind};
 use handle::RsvgHandle;
 use node::{NodeResult, NodeTrait, RsvgNode};
 use parsers::{self, parse, Parse};
@@ -237,7 +237,7 @@ impl Filter for Composite {
 
 impl Parse for Operator {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(parser: &mut Parser<'_, '_>, _data: Self::Data) -> Result<Self, Self::Err> {
         let loc = parser.current_source_location();
@@ -256,7 +256,7 @@ impl Parse for Operator {
                         cow.as_ref().to_string(),
                     ))),
                 ),
-            }).map_err(|_| AttributeError::Value("invalid operator value".to_string()))
+            }).map_err(|_| ValueErrorKind::Value("invalid operator value".to_string()))
     }
 }
 
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index 4cdccac3..84068201 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -8,7 +8,7 @@ use owning_ref::RcRef;
 use attributes::Attribute;
 use coord_units::CoordUnits;
 use drawing_ctx::DrawingCtx;
-use error::AttributeError;
+use error::ValueErrorKind;
 use handle::RsvgHandle;
 use length::{Length, LengthDir, LengthUnit};
 use node::{NodeResult, NodeTrait, NodeType, RsvgNode};
@@ -136,7 +136,7 @@ impl NodeTrait for Primitive {
 
             match length.unit {
                 LengthUnit::Default | LengthUnit::Percent => Ok(length),
-                _ => Err(AttributeError::Parse(ParseError::new(
+                _ => Err(ValueErrorKind::Parse(ParseError::new(
                     "unit identifiers are not allowed with primitiveUnits set to objectBoundingBox",
                 ))),
             }
diff --git a/rsvg_internals/src/filters/node.rs b/rsvg_internals/src/filters/node.rs
index bf6483c0..1612d681 100644
--- a/rsvg_internals/src/filters/node.rs
+++ b/rsvg_internals/src/filters/node.rs
@@ -3,7 +3,7 @@ use std::cell::Cell;
 
 use attributes::Attribute;
 use coord_units::CoordUnits;
-use error::AttributeError;
+use error::ValueErrorKind;
 use handle::RsvgHandle;
 use length::{Length, LengthDir, LengthUnit};
 use node::{NodeResult, NodeTrait, RsvgNode};
@@ -59,7 +59,7 @@ impl NodeTrait for NodeFilter {
 
             match length.unit {
                 LengthUnit::Default | LengthUnit::Percent => Ok(length),
-                _ => Err(AttributeError::Parse(ParseError::new(
+                _ => Err(ValueErrorKind::Parse(ParseError::new(
                     "unit identifiers are not allowed with filterUnits set to objectBoundingBox",
                 ))),
             }
diff --git a/rsvg_internals/src/font_props.rs b/rsvg_internals/src/font_props.rs
index be61c187..936937b6 100644
--- a/rsvg_internals/src/font_props.rs
+++ b/rsvg_internals/src/font_props.rs
@@ -74,12 +74,12 @@ impl FontSizeSpec {
 
 impl Parse for FontSizeSpec {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<FontSizeSpec, ::error::AttributeError> {
+    ) -> Result<FontSizeSpec, ::error::ValueErrorKind> {
         let parser_state = parser.state();
 
         Length::parse(parser, LengthDir::Both)
@@ -89,7 +89,7 @@ impl Parse for FontSizeSpec {
 
                 {
                     let token = parser.next().map_err(|_| {
-                        ::error::AttributeError::Parse(::parsers::ParseError::new("expected token"))
+                        ::error::ValueErrorKind::Parse(::parsers::ParseError::new("expected token"))
                     })?;
 
                     if let Token::Ident(ref cow) = token {
@@ -135,12 +135,12 @@ pub enum FontWeightSpec {
 
 impl Parse for FontWeightSpec {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<FontWeightSpec, ::error::AttributeError> {
+    ) -> Result<FontWeightSpec, ::error::ValueErrorKind> {
         if let Ok(r) = parser.try(|p| {
             p.expect_ident()
                 .map_err(|_| ())
@@ -172,7 +172,7 @@ impl Parse for FontWeightSpec {
             }) {
             Ok(r)
         } else {
-            Err(AttributeError::Parse(ParseError::new(
+            Err(ValueErrorKind::Parse(ParseError::new(
                 "invalid font-weight specification",
             )))
         }
@@ -212,12 +212,12 @@ impl LetterSpacingSpec {
 
 impl Parse for LetterSpacingSpec {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<LetterSpacingSpec, ::error::AttributeError> {
+    ) -> Result<LetterSpacingSpec, ::error::ValueErrorKind> {
         let parser_state = parser.state();
 
         Length::parse(parser, LengthDir::Horizontal)
@@ -227,7 +227,7 @@ impl Parse for LetterSpacingSpec {
 
                 {
                     let token = parser.next().map_err(|_| {
-                        ::error::AttributeError::Parse(::parsers::ParseError::new("expected token"))
+                        ::error::ValueErrorKind::Parse(::parsers::ParseError::new("expected token"))
                     })?;
 
                     if let Token::Ident(ref cow) = token {
@@ -251,14 +251,14 @@ pub struct SingleFontFamily(pub String);
 
 impl Parse for SingleFontFamily {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     fn parse(
         parser: &mut Parser<'_, '_>,
         _: Self::Data,
-    ) -> Result<SingleFontFamily, AttributeError> {
+    ) -> Result<SingleFontFamily, ValueErrorKind> {
         parse_single_font_family(parser)
-            .map_err(|_| AttributeError::from(ParseError::new("expected font family")))
+            .map_err(|_| ValueErrorKind::from(ParseError::new("expected font family")))
     }
 }
 
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index a42fe4fe..bf7bf9f4 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -37,9 +37,9 @@ pub enum SpreadMethod {
 
 impl Parse for SpreadMethod {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<SpreadMethod, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<SpreadMethod, ValueErrorKind> {
         let loc = parser.current_source_location();
 
         parser
@@ -54,7 +54,7 @@ impl Parse for SpreadMethod {
                     ))),
                 ),
             }).map_err(|_| {
-                AttributeError::Parse(ParseError::new("expected 'pad' | 'reflect' | 'repeat'"))
+                ValueErrorKind::Parse(ParseError::new("expected 'pad' | 'reflect' | 'repeat'"))
             })
     }
 }
diff --git a/rsvg_internals/src/length.rs b/rsvg_internals/src/length.rs
index 4bdd27e5..1d4257b8 100644
--- a/rsvg_internals/src/length.rs
+++ b/rsvg_internals/src/length.rs
@@ -55,8 +55,8 @@ const PICA_PER_INCH: f64 = 6.0;
 // inside Length::normalize(), when it needs to know to what the
 // length refers.
 
-fn make_err() -> AttributeError {
-    AttributeError::Parse(ParseError::new(
+fn make_err() -> ValueErrorKind {
+    ValueErrorKind::Parse(ParseError::new(
         "expected length: number(\"em\" | \"ex\" | \"px\" | \"in\" | \"cm\" | \"mm\" | \"pt\" | \
          \"pc\" | \"%\")?",
     ))
@@ -64,9 +64,9 @@ fn make_err() -> AttributeError {
 
 impl Parse for Length {
     type Data = LengthDir;
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, dir: LengthDir) -> Result<Length, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, dir: LengthDir) -> Result<Length, ValueErrorKind> {
         let length = Length::from_cssparser(parser, dir)?;
 
         parser.expect_exhausted().map_err(|_| make_err())?;
@@ -84,11 +84,11 @@ impl Length {
         }
     }
 
-    pub fn check_nonnegative(self) -> Result<Length, AttributeError> {
+    pub fn check_nonnegative(self) -> Result<Length, ValueErrorKind> {
         if self.length >= 0.0 {
             Ok(self)
         } else {
-            Err(AttributeError::Value(
+            Err(ValueErrorKind::Value(
                 "value must be non-negative".to_string(),
             ))
         }
@@ -140,10 +140,10 @@ impl Length {
     pub fn from_cssparser(
         parser: &mut Parser<'_, '_>,
         dir: LengthDir,
-    ) -> Result<Length, AttributeError> {
+    ) -> Result<Length, ValueErrorKind> {
         let length = {
             let token = parser.next().map_err(|_| {
-                AttributeError::Parse(ParseError::new(
+                ValueErrorKind::Parse(ParseError::new(
                     "expected number and optional symbol, or number and percentage",
                 ))
             })?;
@@ -274,9 +274,9 @@ impl Default for Dasharray {
 
 impl Parse for Dasharray {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<Dasharray, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<Dasharray, ValueErrorKind> {
         if parser.try(|p| p.expect_ident_matching("none")).is_ok() {
             Ok(Dasharray::None)
         } else {
@@ -286,7 +286,7 @@ impl Parse for Dasharray {
 }
 
 // This does not handle "inherit" or "none" state, the caller is responsible for that.
-fn parse_dash_array(parser: &mut Parser<'_, '_>) -> Result<Vec<Length>, AttributeError> {
+fn parse_dash_array(parser: &mut Parser<'_, '_>) -> Result<Vec<Length>, ValueErrorKind> {
     let mut dasharray = Vec::new();
 
     loop {
@@ -475,7 +475,7 @@ mod tests {
         );
     }
 
-    fn parse_dash_array_str(s: &str) -> Result<Dasharray, AttributeError> {
+    fn parse_dash_array_str(s: &str) -> Result<Dasharray, ValueErrorKind> {
         Dasharray::parse_str(s, ())
     }
 
@@ -529,7 +529,7 @@ mod tests {
         // Negative numbers
         assert_eq!(
             parse_dash_array_str("20,40,-20"),
-            Err(AttributeError::Value(String::from(
+            Err(ValueErrorKind::Value(String::from(
                 "value must be non-negative"
             )))
         );
diff --git a/rsvg_internals/src/marker.rs b/rsvg_internals/src/marker.rs
index df6132fb..40adc887 100644
--- a/rsvg_internals/src/marker.rs
+++ b/rsvg_internals/src/marker.rs
@@ -36,9 +36,9 @@ impl Default for MarkerUnits {
 
 impl Parse for MarkerUnits {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<MarkerUnits, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<MarkerUnits, ValueErrorKind> {
         let loc = parser.current_source_location();
 
         parser
@@ -52,7 +52,7 @@ impl Parse for MarkerUnits {
                     ))),
                 ),
             }).map_err(|_| {
-                AttributeError::Parse(ParseError::new(
+                ValueErrorKind::Parse(ParseError::new(
                     "expected \"userSpaceOnUse\" or \"strokeWidth\"",
                 ))
             })
@@ -74,15 +74,15 @@ impl Default for MarkerOrient {
 
 impl Parse for MarkerOrient {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<MarkerOrient, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<MarkerOrient, ValueErrorKind> {
         if parser.try(|p| p.expect_ident_matching("auto")).is_ok() {
             Ok(MarkerOrient::Auto)
         } else {
             parsers::angle_degrees(parser)
                 .map(MarkerOrient::Degrees)
-                .map_err(AttributeError::Parse)
+                .map_err(ValueErrorKind::Parse)
         }
     }
 }
@@ -879,10 +879,10 @@ mod parser_tests {
     #[test]
     fn parsing_invalid_marker_units_yields_error() {
         assert!(is_parse_error(
-            &MarkerUnits::parse_str("", ()).map_err(|e| AttributeError::from(e))
+            &MarkerUnits::parse_str("", ()).map_err(|e| ValueErrorKind::from(e))
         ));
         assert!(is_parse_error(
-            &MarkerUnits::parse_str("foo", ()).map_err(|e| AttributeError::from(e))
+            &MarkerUnits::parse_str("foo", ()).map_err(|e| ValueErrorKind::from(e))
         ));
     }
 
@@ -901,13 +901,13 @@ mod parser_tests {
     #[test]
     fn parsing_invalid_marker_orient_yields_error() {
         assert!(is_parse_error(
-            &MarkerOrient::parse_str("", ()).map_err(|e| AttributeError::from(e))
+            &MarkerOrient::parse_str("", ()).map_err(|e| ValueErrorKind::from(e))
         ));
         assert!(is_parse_error(
-            &MarkerOrient::parse_str("blah", ()).map_err(|e| AttributeError::from(e))
+            &MarkerOrient::parse_str("blah", ()).map_err(|e| ValueErrorKind::from(e))
         ));
         assert!(is_parse_error(
-            &MarkerOrient::parse_str("45blah", ()).map_err(|e| AttributeError::from(e))
+            &MarkerOrient::parse_str("45blah", ()).map_err(|e| ValueErrorKind::from(e))
         ));
     }
 
diff --git a/rsvg_internals/src/paint_server.rs b/rsvg_internals/src/paint_server.rs
index 1ba16944..7e8f25a6 100644
--- a/rsvg_internals/src/paint_server.rs
+++ b/rsvg_internals/src/paint_server.rs
@@ -21,9 +21,9 @@ pub enum PaintServer {
 
 impl Parse for PaintServer {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<PaintServer, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<PaintServer, ValueErrorKind> {
         if parser.try(|i| i.expect_ident_matching("none")).is_ok() {
             Ok(PaintServer::None)
         } else if let Ok(url) = parser.try(|i| i.expect_url()) {
@@ -44,7 +44,7 @@ impl Parse for PaintServer {
         } else {
             cssparser::Color::parse(parser)
                 .map(PaintServer::SolidColor)
-                .map_err(AttributeError::from)
+                .map_err(ValueErrorKind::from)
         }
     }
 }
diff --git a/rsvg_internals/src/parsers.rs b/rsvg_internals/src/parsers.rs
index 3333f72d..03efd310 100644
--- a/rsvg_internals/src/parsers.rs
+++ b/rsvg_internals/src/parsers.rs
@@ -7,7 +7,7 @@ use std::f64::consts::*;
 use std::str::{self, FromStr};
 
 use attributes::Attribute;
-use error::{AttributeError, NodeError};
+use error::{NodeError, ValueErrorKind};
 use util::utf8_cstr;
 
 #[derive(Debug, Clone, PartialEq)]
@@ -48,24 +48,24 @@ pub trait Parse: Sized {
 
 impl Parse for f64 {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<f64, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<f64, ValueErrorKind> {
         Ok(f64::from(parser.expect_number().map_err(|_| {
-            AttributeError::Parse(ParseError::new("expected number"))
+            ValueErrorKind::Parse(ParseError::new("expected number"))
         })?))
     }
 }
 
 impl Parse for String {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<String, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<String, ValueErrorKind> {
         Ok(String::from(
             parser
                 .expect_string()
-                .map_err(|_| AttributeError::Parse(ParseError::new("expected string")))?
+                .map_err(|_| ValueErrorKind::Parse(ParseError::new("expected string")))?
                 .as_ref(),
         ))
     }
@@ -80,7 +80,7 @@ impl Parse for String {
 /// `LengthDir::Horizontal` for `data`, for example.
 pub fn parse<T>(key: &str, value: &str, data: <T as Parse>::Data) -> Result<T, NodeError>
 where
-    T: Parse<Err = AttributeError>,
+    T: Parse<Err = ValueErrorKind>,
 {
     let mut input = ParserInput::new(value);
     let mut parser = Parser::new(&mut input);
@@ -103,8 +103,8 @@ pub fn parse_and_validate<T, F>(
     validate: F,
 ) -> Result<T, NodeError>
 where
-    T: Parse<Err = AttributeError>,
-    F: FnOnce(T) -> Result<T, AttributeError>,
+    T: Parse<Err = ValueErrorKind>,
+    F: FnOnce(T) -> Result<T, ValueErrorKind>,
 {
     let mut input = ParserInput::new(value);
     let mut parser = Parser::new(&mut input);
diff --git a/rsvg_internals/src/property_macros.rs b/rsvg_internals/src/property_macros.rs
index 04a86e93..2335e3c9 100644
--- a/rsvg_internals/src/property_macros.rs
+++ b/rsvg_internals/src/property_macros.rs
@@ -25,7 +25,7 @@ pub trait Property<T> {
 /// variants.  It will generate an `impl Default for StrokeLinejoin`
 /// with the provided `default:` value.  Finally, it will generate an
 /// `impl Parse for StrokeLinejoin`, from `parsers::Parse`, where
-/// `type Data = ()` and `type Err = AttributeError`.
+/// `type Data = ()` and `type Err = ValueErrorKind`.
 #[macro_export]
 macro_rules! make_property {
     ($computed_values_type: ty,
@@ -45,9 +45,9 @@ macro_rules! make_property {
 
         impl ::parsers::Parse for $name {
             type Data = ();
-            type Err = ::error::AttributeError;
+            type Err = ::error::ValueErrorKind;
 
-            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, _: Self::Data) -> Result<$name, 
::error::AttributeError> {
+            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, _: Self::Data) -> Result<$name, 
::error::ValueErrorKind> {
                 let loc = parser.current_source_location();
 
                 parser
@@ -63,7 +63,7 @@ macro_rules! make_property {
                             ),
                     })
                     .map_err(|_| {
-                        ::error::AttributeError::Parse(::parsers::ParseError::new(
+                        ::error::ValueErrorKind::Parse(::parsers::ParseError::new(
                             "unexpected value",
                         ))
                     })
@@ -95,9 +95,9 @@ macro_rules! make_property {
 
         impl ::parsers::Parse for $name {
             type Data = $parse_data_type;
-            type Err = ::error::AttributeError;
+            type Err = ::error::ValueErrorKind;
 
-            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, d: Self::Data) -> Result<$name, 
::error::AttributeError> {
+            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, d: Self::Data) -> Result<$name, 
::error::ValueErrorKind> {
                 Ok($name(<$type as ::parsers::Parse>::parse(parser, d)?))
             }
         }
@@ -119,9 +119,9 @@ macro_rules! make_property {
 
         impl ::parsers::Parse for $name {
             type Data = $parse_data_type;
-            type Err = ::error::AttributeError;
+            type Err = ::error::ValueErrorKind;
 
-            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, d: Self::Data) -> Result<$name, 
::error::AttributeError> {
+            fn parse(parser: &mut ::cssparser::Parser<'_, '_>, d: Self::Data) -> Result<$name, 
::error::ValueErrorKind> {
                 Ok($name(<$type as ::parsers::Parse>::parse(parser, d)?))
             }
         }
diff --git a/rsvg_internals/src/state.rs b/rsvg_internals/src/state.rs
index df017b93..ef1cf3da 100644
--- a/rsvg_internals/src/state.rs
+++ b/rsvg_internals/src/state.rs
@@ -302,7 +302,7 @@ impl State {
         accept_shorthands: bool,
     ) -> Result<(), NodeError> {
         // FIXME: move this to "do catch" when we can bump the rustc version dependency
-        let mut parse = || -> Result<(), AttributeError> {
+        let mut parse = || -> Result<(), ValueErrorKind> {
             // please keep these sorted
             match attr {
                 Attribute::BaselineShift => {
@@ -661,15 +661,15 @@ make_property!(
     parse_impl: {
         impl Parse for BaselineShift {
             type Data = ();
-            type Err = AttributeError;
+            type Err = ValueErrorKind;
 
             // These values come from Inkscape's SP_CSS_BASELINE_SHIFT_(SUB/SUPER/BASELINE);
             // see sp_style_merge_baseline_shift_from_parent()
-            fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<BaselineShift, 
::error::AttributeError> {
+            fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<BaselineShift, 
::error::ValueErrorKind> {
                 let parser_state = parser.state();
 
                 {
-                    let token = parser.next().map_err(|_| ::error::AttributeError::Parse(
+                    let token = parser.next().map_err(|_| ::error::ValueErrorKind::Parse(
                         ::parsers::ParseError::new("expected token"),
                     ))?;
 
@@ -1226,9 +1226,9 @@ make_property!(
     parse_impl: {
         impl Parse for TextDecoration {
             type Data = ();
-            type Err = AttributeError;
+            type Err = ValueErrorKind;
 
-            fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<TextDecoration, AttributeError> {
+            fn parse(parser: &mut Parser<'_, '_>, _: Self::Data) -> Result<TextDecoration, ValueErrorKind> {
                 let mut overline = false;
                 let mut underline = false;
                 let mut strike = false;
@@ -1238,7 +1238,7 @@ make_property!(
                 }
 
                 while !parser.is_exhausted() {
-                    let cow = parser.expect_ident().map_err(|_| ::error::AttributeError::Parse(
+                    let cow = parser.expect_ident().map_err(|_| ::error::ValueErrorKind::Parse(
                         ::parsers::ParseError::new("expected identifier"),
                     ))?;
 
@@ -1246,7 +1246,7 @@ make_property!(
                         "overline" => overline = true,
                         "underline" => underline = true,
                         "line-through" => strike = true,
-                        _ => return Err(AttributeError::Parse(ParseError::new("invalid syntax"))),
+                        _ => return Err(ValueErrorKind::Parse(ParseError::new("invalid syntax"))),
                     }
                 }
 
diff --git a/rsvg_internals/src/stop.rs b/rsvg_internals/src/stop.rs
index 7ed2aaab..7b6d0e60 100644
--- a/rsvg_internals/src/stop.rs
+++ b/rsvg_internals/src/stop.rs
@@ -24,7 +24,7 @@ impl NodeStop {
     }
 }
 
-fn validate_offset(length: Length) -> Result<Length, AttributeError> {
+fn validate_offset(length: Length) -> Result<Length, ValueErrorKind> {
     match length.unit {
         LengthUnit::Default | LengthUnit::Percent => {
             let mut offset = length.length;
@@ -38,7 +38,7 @@ fn validate_offset(length: Length) -> Result<Length, AttributeError> {
             Ok(Length::new(offset, LengthUnit::Default, LengthDir::Both))
         }
 
-        _ => Err(AttributeError::Value(
+        _ => Err(ValueErrorKind::Value(
             "stop offset must be in default or percent units".to_string(),
         )),
     }
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index b4c07040..01c572a6 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -10,15 +10,15 @@ use parsers::{optional_comma, Parse, ParseError};
 
 impl Parse for cairo::Matrix {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<cairo::Matrix, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<cairo::Matrix, ValueErrorKind> {
         let matrix = parse_transform_list(parser)?;
 
         matrix
             .try_invert()
             .map(|_| matrix)
-            .map_err(|_| AttributeError::Value("invalid transformation matrix".to_string()))
+            .map_err(|_| ValueErrorKind::Value("invalid transformation matrix".to_string()))
     }
 }
 
@@ -26,7 +26,7 @@ impl Parse for cairo::Matrix {
 // Its operataion and grammar are described here:
 // https://www.w3.org/TR/SVG/coords.html#TransformAttribute
 
-fn parse_transform_list(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_transform_list(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     let mut matrix = cairo::Matrix::identity();
 
     loop {
@@ -43,13 +43,13 @@ fn parse_transform_list(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, At
     Ok(matrix)
 }
 
-fn make_expected_function_error() -> AttributeError {
-    AttributeError::from(ParseError::new(
+fn make_expected_function_error() -> ValueErrorKind {
+    ValueErrorKind::from(ParseError::new(
         "expected matrix|translate|scale|rotate|skewX|skewY",
     ))
 }
 
-fn parse_transform_command(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_transform_command(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     match parser.next()?.clone() {
         Token::Function(ref name) => parse_transform_function(name, parser),
 
@@ -65,7 +65,7 @@ fn parse_transform_command(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix,
 fn parse_transform_function(
     name: &str,
     parser: &mut Parser<'_, '_>,
-) -> Result<cairo::Matrix, AttributeError> {
+) -> Result<cairo::Matrix, ValueErrorKind> {
     match name {
         "matrix" => parse_matrix_args(parser),
         "translate" => parse_translate_args(parser),
@@ -77,7 +77,7 @@ fn parse_transform_function(
     }
 }
 
-fn parse_matrix_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_matrix_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let xx = f64::from(p.expect_number()?);
@@ -99,10 +99,10 @@ fn parse_matrix_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Attri
 
             Ok(cairo::Matrix::new(xx, yx, xy, yy, x0, y0))
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
-fn parse_translate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_translate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let tx = f64::from(p.expect_number()?);
@@ -116,10 +116,10 @@ fn parse_translate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, At
 
             Ok(cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, tx, ty))
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
-fn parse_scale_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_scale_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let x = f64::from(p.expect_number()?);
@@ -133,10 +133,10 @@ fn parse_scale_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Attrib
 
             Ok(cairo::Matrix::new(x, 0.0, 0.0, y, 0.0, 0.0))
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
-fn parse_rotate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_rotate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let angle = f64::from(p.expect_number()?) * PI / 180.0;
@@ -159,25 +159,25 @@ fn parse_rotate_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, Attri
             m = cairo::Matrix::multiply(&cairo::Matrix::new(1.0, 0.0, 0.0, 1.0, -tx, -ty), &m);
             Ok(m)
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
-fn parse_skewx_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_skewx_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let a = f64::from(p.expect_number()?) * PI / 180.0;
             Ok(cairo::Matrix::new(1.0, 0.0, a.tan(), 1.0, 0.0, 0.0))
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
-fn parse_skewy_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, AttributeError> {
+fn parse_skewy_args(parser: &mut Parser<'_, '_>) -> Result<cairo::Matrix, ValueErrorKind> {
     parser
         .parse_nested_block(|p| {
             let a = f64::from(p.expect_number()?) * PI / 180.0;
             Ok(cairo::Matrix::new(1.0, a.tan(), 0.0, 1.0, 0.0, 0.0))
         }).map_err(CssParseError::<()>::basic)
-        .map_err(AttributeError::from)
+        .map_err(ValueErrorKind::from)
 }
 
 #[cfg(test)]
@@ -198,7 +198,7 @@ fn make_rotation_matrix(angle_degrees: f64, tx: f64, ty: f64) -> cairo::Matrix {
 mod tests {
     use super::*;
 
-    fn parse_transform(s: &str) -> Result<cairo::Matrix, AttributeError> {
+    fn parse_transform(s: &str) -> Result<cairo::Matrix, ValueErrorKind> {
         cairo::Matrix::parse_str(s, ())
     }
 
@@ -217,7 +217,7 @@ mod tests {
 
     fn assert_parse_error(s: &str) {
         match parse_transform(s) {
-            Err(AttributeError::Parse(_)) => {}
+            Err(ValueErrorKind::Parse(_)) => {}
             _ => {
                 panic!();
             }
@@ -239,21 +239,21 @@ mod tests {
     #[test]
     fn invalid_transform_yields_value_error() {
         match parse_transform("matrix (0 0 0 0 0 0)") {
-            Err(AttributeError::Value(_)) => {}
+            Err(ValueErrorKind::Value(_)) => {}
             _ => {
                 panic!();
             }
         }
 
         match parse_transform("scale (0), translate (10, 10)") {
-            Err(AttributeError::Value(_)) => {}
+            Err(ValueErrorKind::Value(_)) => {}
             _ => {
                 panic!();
             }
         }
 
         match parse_transform("scale (0), skewX (90)") {
-            Err(AttributeError::Value(_)) => {}
+            Err(ValueErrorKind::Value(_)) => {}
             _ => {
                 panic!();
             }
diff --git a/rsvg_internals/src/unitinterval.rs b/rsvg_internals/src/unitinterval.rs
index 8c3de496..a0ff916d 100644
--- a/rsvg_internals/src/unitinterval.rs
+++ b/rsvg_internals/src/unitinterval.rs
@@ -14,13 +14,13 @@ impl Default for UnitInterval {
 
 impl Parse for UnitInterval {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<UnitInterval, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<UnitInterval, ValueErrorKind> {
         let x = f64::from(
             parser
                 .expect_number()
-                .map_err(|_| AttributeError::Parse(ParseError::new("expected number")))?,
+                .map_err(|_| ValueErrorKind::Parse(ParseError::new("expected number")))?,
         );
 
         let cx = if x < 0.0 {
diff --git a/rsvg_internals/src/viewbox.rs b/rsvg_internals/src/viewbox.rs
index 84ed7942..cc7d7bc3 100644
--- a/rsvg_internals/src/viewbox.rs
+++ b/rsvg_internals/src/viewbox.rs
@@ -27,7 +27,7 @@ impl ViewBox {
 
 impl Parse for ViewBox {
     type Data = ();
-    type Err = AttributeError;
+    type Err = ValueErrorKind;
 
     // Parse a viewBox attribute
     // https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
@@ -37,7 +37,7 @@ impl Parse for ViewBox {
     // x, y, w, h
     //
     // Where w and h must be nonnegative.
-    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<ViewBox, AttributeError> {
+    fn parse(parser: &mut Parser<'_, '_>, _: ()) -> Result<ViewBox, ValueErrorKind> {
         let v = parsers::number_list(parser, ListLength::Exact(4))
             .map_err(|_| ParseError::new("string does not match 'x [,] y [,] w [,] h'"))?;
 
@@ -51,7 +51,7 @@ impl Parse for ViewBox {
                 height: h,
             }))
         } else {
-            Err(AttributeError::Value(
+            Err(ValueErrorKind::Value(
                 "width and height must not be negative".to_string(),
             ))
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]