use std::{
error::Error,
fmt,
};
use crate::error::DeliveryError;
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum EmissionError {
SequenceExhausted,
Delivery(DeliveryError),
}
impl fmt::Display for EmissionError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::SequenceExhausted => {
formatter.write_str("progress event sequence is exhausted")
}
Self::Delivery(error) => error.fmt(formatter),
}
}
}
impl Error for EmissionError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
Self::SequenceExhausted => None,
Self::Delivery(error) => Some(error),
}
}
}