pub struct RawFeed { pub provider: &'static str, pub feed: &'static str, pub scope: Box, pub captured_at: chrono::DateTime, pub source_at: Option>, pub content_type: Box, pub body: Vec, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum FeedStage { Provider, Parse, Commit, } impl FeedStage { pub(crate) fn as_str(self) -> &'static str { match self { Self::Provider => "provider", Self::Parse => "parse", Self::Commit => "commit", } } } #[derive(Debug)] pub struct FeedFailure { pub stage: FeedStage, pub source: anyhow::Error, } impl std::fmt::Display for FeedFailure { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}: {:#}", self.stage, self.source) } } impl std::error::Error for FeedFailure { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(self.source.as_ref()) } }