core error types

This commit is contained in:
2025-03-25 18:24:24 +02:00
parent 950c2772cd
commit 2e08e3c730
+30
View File
@@ -0,0 +1,30 @@
use thiserror::Error;
#[derive(Debug, Error)]
pub enum CrucivError {
#[error("{0}")]
Generation(String),
#[error("Generation timed out - try a smaller grid or lower fill percentage")]
Timeout(u64),
#[error("invalid grid: {0}")]
InvalidGrid(String),
#[error("validation failed: {0}")]
Validation(String),
#[error("dictionary error: {0}")]
Dictionary(String),
#[error("no clue found for word: {0}")]
MissingClue(String),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, CrucivError>;