liminal_sdk/error.rs
1use alloc::string::String;
2
3/// Error taxonomy returned by the Rust SDK API surface.
4///
5/// The SDK keeps application code independent from transport, protocol framing,
6/// and core implementation error types. Concrete embedded and remote adapters
7/// map their internal failures into these variants.
8#[derive(Debug, thiserror::Error)]
9pub enum SdkError {
10 /// Establishing, keeping, or recovering a client connection failed.
11 #[error("connection error: {description}")]
12 Connection {
13 /// Human-readable context from the failing connection operation.
14 description: String,
15 },
16
17 /// Encoding, decoding, or interpreting SDK-internal protocol state failed.
18 #[error("protocol error: {description}")]
19 Protocol {
20 /// Human-readable protocol failure context.
21 description: String,
22 },
23
24 /// Serialising an outbound value or deserialising an inbound value failed.
25 #[error("serialization error: {description}")]
26 Serialization {
27 /// Human-readable serialization failure context.
28 description: String,
29 },
30
31 /// A typed message did not satisfy the schema declared for its channel.
32 #[error("type validation failed: {description}")]
33 TypeValidation {
34 /// Human-readable type-validation context.
35 description: String,
36 },
37
38 /// A publish operation encountered application-visible backpressure.
39 #[error("backpressure: {reason}")]
40 Backpressure {
41 /// Human-readable pressure reason.
42 reason: String,
43 },
44
45 /// A conversation operation failed.
46 #[error("conversation {conversation_id}: {description}")]
47 Conversation {
48 /// Application-visible conversation identifier.
49 conversation_id: String,
50 /// Human-readable conversation failure context.
51 description: String,
52 },
53
54 /// Persisted subscription or recovery state could not be read or written.
55 #[error("store error: {description}")]
56 Store {
57 /// Human-readable store failure context.
58 description: String,
59 },
60}