wordle-analyzer/src/error.rs

30 lines
689 B
Rust
Raw Normal View History

2024-03-22 00:01:40 +01:00
use thiserror::Error;
2024-03-22 13:00:49 +01:00
pub type WResult<T> = std::result::Result<T, Error>;
2024-03-22 00:01:40 +01:00
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,
},
2024-03-22 14:12:49 +01:00
// for `FromStr` of `BuiltinSolver`
#[error("Unknown builtin solver")]
UnknownBuiltinSolver
2024-03-22 00:01:40 +01:00
}
#[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,
}