wordle-analyzer/src/error.rs

27 lines
584 B
Rust
Raw Normal View History

2024-03-22 00:01:40 +01:00
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
pub type GameResult<T> = std::result::Result<T, GameError>;
#[derive(Debug, Error)]
pub enum Error {
#[error("GameError")]
GameError {
#[from]
source: GameError,
},
#[error(transparent)]
Other {
#[from]
source: anyhow::Error,
},
}
#[derive(Debug, Clone, Error)]
pub enum GameError {
#[error("The guess has the wrong length")]
GuessHasWrongLength,
#[error("The game is finished but a guess is being made")]
TryingToPlayAFinishedGame,
}