dice_command_parser/error.rs
1use std::num::ParseIntError;
2use thiserror::Error;
3
4#[derive(Error, Debug, PartialEq)]
5/// Errors that can occur parsing the command input.
6pub enum ParserError {
7 #[error("An error ocurred parsing the input. {0}")]
8 /// Implies that the string was not in the correct format.
9 ParseError(String),
10 #[error("An invalid number was entered")]
11 /// Occurs when the numbers provided in the input cannot be turned into `i32`. This is likely an overflow or underflow error.
12 InvalidNumberInput(#[from] ParseIntError),
13 /// Reserved for errors that do not fit into other categories.
14 #[error("An unknown error occurred.")]
15 Unknown,
16}