1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
5pub enum TimerError {
6 InvalidSlotCount {
9 slot_count: usize,
10 reason: &'static str,
11 },
12
13 InvalidConfiguration {
15 field: String,
16 reason: String,
17 },
18
19 RegisterFailed,
22}
23
24impl fmt::Display for TimerError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 TimerError::InvalidSlotCount { slot_count, reason } => {
28 write!(f, "Invalid slot count {}: {}", slot_count, reason)
29 }
30 TimerError::InvalidConfiguration { field, reason } => {
31 write!(f, "Configuration validation failed ({}): {}", field, reason)
32 }
33 TimerError::RegisterFailed => {
34 write!(f, "Registration failed: internal channel is full or closed")
35 }
36 }
37 }
38}
39
40impl std::error::Error for TimerError {}
41