use crate::dice::DiceRoll;
use thiserror::Error;
#[derive(Debug, Clone, Error)]
pub enum RollError {
#[error("Adding integers {0} and {1} would overflow")]
IntegerOverFlow(u32, u32),
}
#[derive(Debug, Clone, Error)]
pub enum Error {
#[error(
"'{0}' is an invalid number of sides for a Dice (must be at least {})",
DiceRoll::MINIMUM_SIDES
)]
InvalidSides(u32),
#[error(
"'{0}' is an invalid number of rolls for a Dice (must be at least {})",
DiceRoll::MINIMUM_ROLLS
)]
InvalidRolls(u32),
#[error("Sides were not captured from the provided expression '{0}'.")]
FailedToParseSides(String),
#[error("Rolls were not captured from the provided expression '{0}'.")]
FailedToParseRolls(String),
#[error("'{0}' could not be parsed into a pair of rolls and sides.")]
InvalidExpression(String),
}