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,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
#[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,
|
|
|
|
}
|