use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
Options(#[from] crate::error::OptionsError),
#[error(transparent)]
Greeks(#[from] crate::error::GreeksError),
#[error(transparent)]
Volatility(#[from] crate::error::VolatilityError),
#[error(transparent)]
Chain(#[from] crate::error::ChainError),
#[error(transparent)]
Position(#[from] crate::error::PositionError),
#[error(transparent)]
Strategy(#[from] crate::error::StrategyError),
#[error(transparent)]
Probability(#[from] crate::error::ProbabilityError),
#[error(transparent)]
Curve(#[from] crate::error::CurveError),
#[error(transparent)]
Decimal(#[from] crate::error::DecimalError),
#[error(transparent)]
Interpolation(#[from] crate::error::InterpolationError),
#[error(transparent)]
Metrics(#[from] crate::error::MetricsError),
#[error(transparent)]
Surface(#[from] crate::error::SurfaceError),
#[error(transparent)]
Graph(#[from] crate::error::GraphError),
#[error(transparent)]
Transaction(#[from] crate::error::TransactionError),
#[error(transparent)]
Pricing(#[from] crate::error::PricingError),
#[error(transparent)]
Ohlcv(#[from] crate::error::OhlcvError),
#[error(transparent)]
Simulation(#[from] crate::error::SimulationError),
#[error(transparent)]
Positive(#[from] positive::error::PositiveError),
#[error(transparent)]
Trade(#[from] crate::error::TradeError),
#[error("{0}")]
Other(String),
}
impl From<Box<dyn std::error::Error>> for Error {
fn from(err: Box<dyn std::error::Error>) -> Self {
Error::Other(err.to_string())
}
}
impl From<String> for Error {
fn from(msg: String) -> Self {
Error::Other(msg)
}
}
impl From<&str> for Error {
fn from(msg: &str) -> Self {
Error::Other(msg.to_string())
}
}