core error types
This commit is contained in:
@@ -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>;
|
||||
Reference in New Issue
Block a user