[librsvg: 5/32] Add LoadingError::OutOfMemory




commit 975ce85a0ad5a64c234ea57be526c457cd76fe8a
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Nov 25 11:47:39 2020 -0600

    Add LoadingError::OutOfMemory
    
    The code doesn't't catch OOM yet during loading in general, for example, while
    creating Node structures.  In the future I'd like to do this, so I'll
    leave this error code in place.

 src/error.rs | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/error.rs b/src/error.rs
index 32c8d2c4..accaae22 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -318,6 +318,9 @@ pub enum LoadingError {
     /// XML syntax error.
     XmlParseError(String),
 
+    /// Not enough memory to load the document.
+    OutOfMemory(String),
+
     // FIXME: this is OOM in libxml2; we shouldn't expose it.
     CouldNotCreateXmlParser,
 
@@ -362,6 +365,7 @@ impl fmt::Display for LoadingError {
         match *self {
             LoadingError::NoDataPassedToParser => write!(f, "no data passed to parser"),
             LoadingError::XmlParseError(ref s) => write!(f, "XML parse error: {}", s),
+            LoadingError::OutOfMemory(ref s) => write!(f, "out of memory: {}", s),
             LoadingError::CouldNotCreateXmlParser => write!(f, "could not create XML parser"),
             LoadingError::BadUrl => write!(f, "invalid URL"),
             LoadingError::BadDataUrl => write!(f, "invalid data: URL"),


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