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

@ -1,5 +1,20 @@
use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
BytesTotal,
InputStream,
BytesTotal(usize, usize),
InputStream(glib::Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::BytesTotal(total, limit) => {
write!(f, "Bytes total limit reached: {total} / {limit}")
}
Self::InputStream(reason) => {
write!(f, "Input stream error: {reason}")
}
}
}
}