hyperi_rustlib/dlq/error.rs
1// Project: hyperi-rustlib
2// File: src/dlq/error.rs
3// Purpose: DLQ error types
4// Language: Rust
5//
6// License: BUSL-1.1
7// Copyright: (c) 2026 HYPERI PTY LIMITED
8
9//! Error types for the DLQ module.
10
11use thiserror::Error;
12
13/// Errors from DLQ operations.
14#[derive(Debug, Error)]
15pub enum DlqError {
16 /// File backend I/O error.
17 #[error("file DLQ I/O error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// JSON serialisation error.
21 #[error("DLQ serialisation error: {0}")]
22 Serialization(String),
23
24 /// File backend error (non-I/O).
25 #[error("file DLQ error: {0}")]
26 File(String),
27
28 /// Kafka backend error.
29 #[cfg(feature = "dlq-kafka")]
30 #[error("kafka DLQ error: {0}")]
31 Kafka(String),
32
33 /// Generic backend error (HTTP, Redis, etc.).
34 #[error("DLQ backend error: {0}")]
35 BackendError(String),
36
37 /// All configured backends failed.
38 #[error("all DLQ backends failed: {0}")]
39 AllBackendsFailed(String),
40
41 /// DLQ is disabled or not configured.
42 #[error("DLQ not configured")]
43 NotConfigured,
44
45 /// In-memory queue is full. Caller submitted faster than the drain
46 /// can write; the entry was rejected.
47 #[error("DLQ queue is full")]
48 QueueFull,
49
50 /// DLQ has been shut down -- no further entries accepted.
51 #[error("DLQ has shut down")]
52 Closed,
53}