helios_subscriptions/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum SubscriptionError {
8 #[error("subscription topic not found: {url}")]
10 TopicNotFound { url: String },
11
12 #[error("invalid filter: {message}")]
14 InvalidFilter { message: String },
15
16 #[error("unsupported channel type: {channel_type}")]
18 UnsupportedChannel { channel_type: String },
19
20 #[error("invalid channel endpoint: {message}")]
22 InvalidEndpoint { message: String },
23
24 #[error("delivery failed: {message}")]
26 DeliveryFailed { message: String },
27
28 #[error("invalid status transition from {from} to {to}")]
30 InvalidStatusTransition { from: String, to: String },
31
32 #[error("invalid subscription resource: {message}")]
34 InvalidSubscription { message: String },
35
36 #[error("storage error: {0}")]
38 Storage(String),
39
40 #[error("internal error: {0}")]
42 Internal(String),
43}
44
45impl From<helios_persistence::error::StorageError> for SubscriptionError {
46 fn from(e: helios_persistence::error::StorageError) -> Self {
47 Self::Storage(e.to_string())
48 }
49}
50
51impl From<helios_auth::AuthError> for SubscriptionError {
52 fn from(e: helios_auth::AuthError) -> Self {
53 Self::DeliveryFailed {
54 message: format!("outbound auth failed: {e}"),
55 }
56 }
57}