diff --git a/cruciverb-core/src/error.rs b/cruciverb-core/src/error.rs new file mode 100644 index 0000000..9967757 --- /dev/null +++ b/cruciverb-core/src/error.rs @@ -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 = std::result::Result;