use crate::source::MetricSourceError;
use crate::source::types::SourceEvent;
use thiserror::Error;
use tokio::{sync::mpsc::error::SendError, task::JoinError};
#[derive(Debug, Error)]
pub enum OrchestratorError {
#[error("Join error")]
JoinError(
#[from]
#[source]
JoinError,
),
#[error("Send error")]
SendError(
#[from]
#[source]
SendError<SourceEvent>,
),
#[error("Cannot initialize source: {0}.")]
InitializationError(&'static str),
#[error(
"Cannot aggregate sensor results: phase count mismatch (lhs={lhs}, rhs={rhs}). \
Sources must produce the same number of phases."
)]
PhaseMismatch { lhs: usize, rhs: usize },
#[error("All sensor sources produced zero phases.")]
AllSourcesEmpty,
#[error("No sensor results to merge.")]
NoSensorResults,
#[error("Metric source error.")]
MetricSourceError(
#[from]
#[source]
MetricSourceError,
),
}