profile picture image cache

coding from a plane so this is helping alot with PFPs
This commit is contained in:
William Casarin
2024-02-16 15:42:21 -08:00
parent 1c16ddf9af
commit 87f385b683
8 changed files with 174 additions and 51 deletions

View File

@@ -1,8 +1,10 @@
use std::fmt;
use std::{fmt, io};
#[derive(Debug)]
pub enum Error {
NoActiveSubscription,
LoadFailed,
Io(io::Error),
Nostr(enostr::Error),
Ndb(nostrdb::Error),
Image(image::error::ImageError),
@@ -15,10 +17,14 @@ impl fmt::Display for Error {
Self::NoActiveSubscription => {
write!(f, "subscription not active in timeline")
}
Self::LoadFailed => {
write!(f, "load failed")
}
Self::Nostr(e) => write!(f, "{e}"),
Self::Ndb(e) => write!(f, "{e}"),
Self::Image(e) => write!(f, "{e}"),
Self::Generic(e) => write!(f, "{e}"),
Self::Io(e) => write!(f, "{e}"),
}
}
}
@@ -46,3 +52,9 @@ impl From<enostr::Error> for Error {
Error::Nostr(err)
}
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::Io(err)
}
}