use thiserror::Error;
#[non_exhaustive]
#[derive(Error, Debug, Clone, Copy, PartialEq, Eq)]
pub enum ControllerError {
#[error("controller not configured")]
NotConfigured,
#[error("submission queue full")]
Full,
#[error("controller channel closed")]
Closed,
#[error("controller already started")]
AlreadyStarted,
}
impl ControllerError {
#[must_use]
pub fn as_label(&self) -> &'static str {
match self {
ControllerError::AlreadyStarted => "controller_already_started",
ControllerError::NotConfigured => "controller_not_configured",
ControllerError::Closed => "controller_closed",
ControllerError::Full => "controller_full",
}
}
}