use crate::execution::ExecutionError;
use thiserror::Error;
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum ReportError {
#[error(transparent)]
Execution(#[from] ExecutionError),
#[error("non-finite report or comparison number")]
NonFinite,
#[error("report requires {required} bytes, limit {limit}")]
#[non_exhaustive]
LimitExceeded {
required: usize,
limit: usize,
},
#[error("comparison inputs have incompatible shape or axis semantics")]
IncompatibleInputs,
#[error("invalid comparison/report request: {0}")]
Invalid(&'static str),
#[error("report writer failed: {0}")]
Io(std::io::Error),
}
impl From<std::io::Error> for ReportError {
fn from(error: std::io::Error) -> Self {
match crate::io::io_control_error(&error) {
Some(e) => Self::Execution(e),
None => Self::Io(error),
}
}
}