sleep_utils/error.rs
1use thiserror::Error;
2
3/// Sleep utilities error types
4#[derive(Error, Debug)]
5pub enum SleepError {
6 /// Returned when a duration string cannot be parsed
7 #[error("Invalid duration format: {0}")]
8 InvalidDuration(String),
9
10 /// Returned when general parsing fails
11 #[error("Parse error: {0}")]
12 ParseError(String),
13
14 /// Returned when numeric values are outside valid range
15 #[error("Number out of range: {0}")]
16 NumberOutOfRange(String),
17}
18
19/// Result type alias for sleep-utils operations
20///
21/// This is a convenience type that uses [`SleepError`] as the error type
22/// for all functions in this crate.
23pub type Result<T> = std::result::Result<T, SleepError>;