mytheclipse_queue/
error.rs1#[derive(Debug)]
5pub enum QueueError {
6 Connection(String),
8 NotFound(String),
10 Serialization(String),
12 Timeout,
14 RateLimit(String),
16}
17
18impl std::fmt::Display for QueueError {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 match self {
21 Self::Connection(s) => write!(f, "queue connection error: {s}"),
22 Self::NotFound(s) => write!(f, "queue not found: {s}"),
23 Self::Serialization(s) => write!(f, "serialization error: {s}"),
24 Self::Timeout => write!(f, "queue operation timed out"),
25 Self::RateLimit(s) => write!(f, "queue rate limited: {s}"),
26 }
27 }
28}
29
30impl std::error::Error for QueueError {}
31
32#[derive(Debug)]
34pub enum JobError {
35 AckFailed(String),
37 DlqFailed(String),
39 MaxRetriesExceeded,
41 InvalidPayload(String),
43}
44
45impl std::fmt::Display for JobError {
46 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
47 match self {
48 Self::AckFailed(s) => write!(f, "ack failed: {s}"),
49 Self::DlqFailed(s) => write!(f, "dlq move failed: {s}"),
50 Self::MaxRetriesExceeded => write!(f, "max retries exceeded"),
51 Self::InvalidPayload(s) => write!(f, "invalid payload: {s}"),
52 }
53 }
54}
55
56impl std::error::Error for JobError {}