[librsvg: 3/7] error::LoadingError: new error enum for the loading stage



commit c6eb91d292470597ae575f3655da1ac94120c3f2
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Oct 1 11:14:21 2018 -0500

    error::LoadingError: new error enum for the loading stage

 rsvg_internals/src/error.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/rsvg_internals/src/error.rs b/rsvg_internals/src/error.rs
index 0e3df141..db5a824e 100644
--- a/rsvg_internals/src/error.rs
+++ b/rsvg_internals/src/error.rs
@@ -100,6 +100,20 @@ impl From<cairo::Status> for RenderingError {
     }
 }
 
+#[derive(Clone)]
+pub enum LoadingError {
+    Cairo(cairo::Status),
+    EmptyData,
+}
+
+impl From<cairo::Status> for LoadingError {
+    fn from(e: cairo::Status) -> LoadingError {
+        assert!(e != cairo::Status::Success);
+
+        LoadingError::Cairo(e)
+    }
+}
+
 #[cfg(test)]
 pub fn is_parse_error<T>(r: &Result<T, ValueErrorKind>) -> bool {
     match *r {


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