[librsvg/librsvg-2.44] Rename AttributeError to ValueErrorKind



commit 4e97c7d79b4c2d5854ad2f2f6f9d761970392de2
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 f7655a04..8e5f028c 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 fb41bb67..a5623d53 100644
--- a/rsvg_internals/src/color.rs
+++ b/rsvg_internals/src/color.rs
@@ -10,25 +10,25 @@ 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> {
+    fn parse(parser: &mut Parser, _: Self::Data) -> 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> {
+    fn parse(parser: &mut Parser, _: Self::Data) -> 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",
             ))),
         }
@@ -73,8 +73,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 1317baab..26528be9 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 ec30b8f1..1f5d90e2 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_str(),
                 n.display
             ),
 
-            AttributeError::Value(ref s) => write!(
+            ValueErrorKind::Value(ref s) => write!(
                 f,
                 "invalid value for attribute \"{}\": {}",
                 self.attr.to_str(),
@@ -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 2205578a..0906fd16 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 e0c1d9c4..7848a904 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};
@@ -131,7 +131,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 c178da10..c7bc2751 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 0f6a6d86..e0a0e117 100644
--- a/rsvg_internals/src/font_props.rs
+++ b/rsvg_internals/src/font_props.rs
@@ -74,9 +74,9 @@ 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> {
+    fn parse(parser: &mut Parser, _: Self::Data) -> Result<FontSizeSpec, ::error::ValueErrorKind> {
         let parser_state = parser.state();
 
         Length::parse(parser, LengthDir::Both)
@@ -86,7 +86,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 {
@@ -132,12 +132,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(|_| ())
@@ -169,7 +169,7 @@ impl Parse for FontWeightSpec {
             }) {
             Ok(r)
         } else {
-            Err(AttributeError::Parse(ParseError::new(
+            Err(ValueErrorKind::Parse(ParseError::new(
                 "invalid font-weight specification",
             )))
         }
@@ -209,12 +209,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)
@@ -224,7 +224,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 {
@@ -248,11 +248,11 @@ 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> {
+    fn parse(parser: &mut Parser, _: Self::Data) -> 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 bcc94473..17804181 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 fdec8dd3..153d946c 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(),
             ))
         }
@@ -138,10 +138,10 @@ impl Length {
         }
     }
 
-    pub fn from_cssparser(parser: &mut Parser, dir: LengthDir) -> Result<Length, AttributeError> {
+    pub fn from_cssparser(parser: &mut Parser, dir: LengthDir) -> 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 {
@@ -408,7 +408,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, ())
     }
 
@@ -462,7 +462,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 f94c0d8c..e112db3d 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)
         }
     }
 }
@@ -871,10 +871,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))
         ));
     }
 
@@ -893,13 +893,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 00567e9e..e43a1b4d 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 b54b56a8..d7fcb407 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 9841b47f..31b0b70c 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 f12d5080..e48055f8 100644
--- a/rsvg_internals/src/state.rs
+++ b/rsvg_internals/src/state.rs
@@ -369,7 +369,7 @@ impl State {
         }
 
         // 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 => {
@@ -708,15 +708,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"),
                     ))?;
 
@@ -1273,9 +1273,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;
@@ -1285,7 +1285,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"),
                     ))?;
 
@@ -1293,7 +1293,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 44d5c8b1..1d9b52f4 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 b747375d..8871fa54 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, AttributeE
     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, Attribu
 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, AttributeErro
 
             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, AttributeE
 
             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, AttributeError
 
             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, AttributeErro
             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 b5e0d911..5587a74b 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 155a70e1..938188a0 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]