update memory input stream errors handler

This commit is contained in:
yggverse 2024-11-27 15:39:37 +02:00
parent 3a9e84a3d9
commit 239786da6a
6 changed files with 27 additions and 12 deletions

View file

@ -111,7 +111,7 @@ pub fn read_all_from_stream_async(
// Continue bytes reading
read_all_from_stream_async(buffer, stream, cancelable, priority, callback);
}
Err(reason) => callback(Err(Error::InputStreamRead(reason))),
Err(reason) => callback(Err(Error::InputStream(reason))),
},
);
}

View file

@ -4,7 +4,7 @@ use std::fmt::{Display, Formatter, Result};
pub enum Error {
BufferOverflow,
Decode(std::string::FromUtf8Error),
InputStreamRead(glib::Error),
InputStream(glib::Error),
}
impl Display for Error {
@ -16,7 +16,7 @@ impl Display for Error {
Self::Decode(reason) => {
write!(f, "Decode error: {reason}")
}
Self::InputStreamRead(reason) => {
Self::InputStream(reason) => {
write!(f, "Input stream read error: {reason}")
}
}

View file

@ -147,7 +147,7 @@ pub fn read_from_stream_async(
// Continue
read_from_stream_async(buffer, stream, cancellable, priority, on_complete);
}
Err((data, reason)) => on_complete(Err(Error::InputStreamRead(data, reason))),
Err((data, reason)) => on_complete(Err(Error::InputStream(data, reason))),
},
);
}

View file

@ -3,7 +3,7 @@ use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
Data(super::data::Error),
InputStreamRead(Vec<u8>, glib::Error),
InputStream(Vec<u8>, glib::Error),
Mime(super::mime::Error),
Protocol,
Status(super::status::Error),
@ -15,7 +15,7 @@ impl Display for Error {
Self::Data(reason) => {
write!(f, "Data error: {reason}")
}
Self::InputStreamRead(_, reason) => {
Self::InputStream(_, reason) => {
// @TODO
write!(f, "Input stream error: {reason}")
}