1use std::fmt;
2
3#[derive(Debug)]
5pub enum CrackleError {
6 TaskPanicked(String),
8 KilnCooled,
10 InvalidProfile(String),
12 DetectionFailed(String),
14}
15
16impl fmt::Display for CrackleError {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 CrackleError::TaskPanicked(msg) => write!(f, "task panicked: {msg}"),
20 CrackleError::KilnCooled => write!(f, "kiln has already cooled and cannot accept new tasks"),
21 CrackleError::InvalidProfile(msg) => write!(f, "invalid thermal profile: {msg}"),
22 CrackleError::DetectionFailed(msg) => write!(f, "pattern detection failed: {msg}"),
23 }
24 }
25}
26
27impl std::error::Error for CrackleError {}
28
29pub type Result<T> = std::result::Result<T, CrackleError>;