use std::{error::Error, fmt};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum CompletionRegistryError {
Full,
UnknownCompletion,
DuplicatePublish,
NotificationBackpressure,
UnsettledCompletion,
NotifierStopped,
GenerationExhausted,
ReclaimDisconnected,
}
impl fmt::Display for CompletionRegistryError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Full => formatter.write_str("completion registry is full"),
Self::UnknownCompletion => formatter.write_str("completion identity is stale"),
Self::DuplicatePublish => formatter.write_str("completion is already terminal"),
Self::NotificationBackpressure => {
formatter.write_str("completion notifier is temporarily full")
}
Self::UnsettledCompletion => {
formatter.write_str("an accepted completion is not terminal")
}
Self::NotifierStopped => formatter.write_str("completion notifier has stopped"),
Self::GenerationExhausted => {
formatter.write_str("completion slot generation is exhausted")
}
Self::ReclaimDisconnected => {
formatter.write_str("completion reclaim channel disconnected")
}
}
}
}
impl Error for CompletionRegistryError {}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum CompletionObserverError {
AlreadyObserved,
Stale,
}
impl fmt::Display for CompletionObserverError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::AlreadyObserved => formatter.write_str("completion was already observed"),
Self::Stale => formatter.write_str("completion observer is stale"),
}
}
}
impl Error for CompletionObserverError {}