home: move subscriptions to timeline

This commit is contained in:
William Casarin
2024-02-10 14:46:17 -08:00
parent d7607c8297
commit adc74dd7c9
4 changed files with 67 additions and 51 deletions

View File

@@ -1,26 +1,34 @@
use shatter::parser;
use std::fmt;
#[derive(Debug)]
pub enum Error {
NoActiveSubscription,
Nostr(enostr::Error),
Ndb(nostrdb::Error),
Shatter(parser::Error),
Image(image::error::ImageError),
Generic(String),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NoActiveSubscription => {
write!(f, "subscription not active in timeline")
}
Self::Nostr(e) => write!(f, "{e}"),
Self::Ndb(e) => write!(f, "{e}"),
Self::Image(e) => write!(f, "{e}"),
Self::Generic(e) => write!(f, "{e}"),
}
}
}
impl From<String> for Error {
fn from(s: String) -> Self {
Error::Generic(s)
}
}
impl From<parser::Error> for Error {
fn from(s: parser::Error) -> Self {
Error::Shatter(s)
}
}
impl From<nostrdb::Error> for Error {
fn from(e: nostrdb::Error) -> Self {
Error::Ndb(e)