writing_analysis/
error.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum WritingAnalysisError {
5 #[error("Text is empty")]
6 EmptyText,
7
8 #[error("Text too short for analysis: need at least {min_words} words, found {found}")]
9 TextTooShort { min_words: usize, found: usize },
10
11 #[error("No sentences detected in text")]
12 NoSentences,
13
14 #[error("Lexicon error: {0}")]
15 LexiconError(String),
16
17 #[error("Regex error: {0}")]
18 RegexError(#[from] regex::Error),
19}
20
21pub type Result<T> = std::result::Result<T, WritingAnalysisError>;