1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
use thiserror::Error;
/// Error type.
#[derive(Error, Debug)]
pub enum DemesForwardError {
/// Stores a [`demes::DemesError`].
#[error("{0:?}")]
DemesError(demes::DemesError),
/// Errors related to time.
/// Will be returned if invalid time
/// values occur after converting
/// time to generations.
#[error("{0:?}")]
TimeError(String),
/// Errors related to invalid deme sizes
/// arising during application of size change
/// functions.
#[error("{0:?}")]
InvalidDemeSize(demes::DemeSize),
/// Errors related to invalid internal states.
/// In general, this error indicates a bug
/// that should be reported.
#[error("{0:?}")]
InternalError(String),
}
impl From<demes::DemesError> for DemesForwardError {
fn from(error: demes::DemesError) -> Self {
Self::DemesError(error)
}
}