strafe_error/
distribution.rs

1use std::{
2    error::Error,
3    fmt::{Display, Error as FmtError, Formatter},
4};
5
6#[derive(Debug)]
7pub enum DistributionError {
8    BadX,
9    BadQuantile,
10    BadProbability,
11}
12
13impl Display for DistributionError {
14    fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
15        match &self {
16            DistributionError::BadX => write!(fmt, "x was not a valid input"),
17            DistributionError::BadQuantile => write!(fmt, "q was not a valid input"),
18            DistributionError::BadProbability => write!(fmt, "p was not a valid input"),
19        }
20    }
21}
22
23impl Error for DistributionError {}