use thiserror::Error;
#[derive(Debug, Error)]
pub enum SubscriptionError {
#[error("subscription topic not found: {url}")]
TopicNotFound { url: String },
#[error("invalid filter: {message}")]
InvalidFilter { message: String },
#[error("unsupported channel type: {channel_type}")]
UnsupportedChannel { channel_type: String },
#[error("invalid channel endpoint: {message}")]
InvalidEndpoint { message: String },
#[error("delivery failed: {message}")]
DeliveryFailed { message: String },
#[error("invalid status transition from {from} to {to}")]
InvalidStatusTransition { from: String, to: String },
#[error("invalid subscription resource: {message}")]
InvalidSubscription { message: String },
#[error("storage error: {0}")]
Storage(String),
#[error("internal error: {0}")]
Internal(String),
}
impl From<helios_persistence::error::StorageError> for SubscriptionError {
fn from(e: helios_persistence::error::StorageError) -> Self {
Self::Storage(e.to_string())
}
}
impl From<helios_auth::AuthError> for SubscriptionError {
fn from(e: helios_auth::AuthError) -> Self {
Self::DeliveryFailed {
message: format!("outbound auth failed: {e}"),
}
}
}