use thiserror::Error;
#[derive(Error, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Error {
#[error(transparent)]
BinaryOperationError(#[from] BinaryOperationError),
#[error(transparent)]
AxisError(#[from] AxisError),
}
#[derive(Error, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[error("histogram binary operation failed (check binning?)")]
pub struct BinaryOperationError;
#[derive(Error, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum AxisError {
#[error("number of bins should be positive and non-zero and must be convertible to the coordinate type")]
InvalidNumberOfBins,
#[error("Invalid axis range. Low edge should not equal high edge.")]
InvalidAxisRange,
#[error("axis step size should be non-zero and positive")]
InvalidStepSize,
#[error("the number of bin edges must be at >= 2.")]
InvalidNumberOfBinEdges,
#[error("failed to sort bin_edges. The list of axis bin edges must be sortable.")]
FailedToSortBinEdges,
}