rtmp_rs/registry/
error.rs

1//! Registry error types
2//!
3//! Error types for stream registry operations.
4
5use super::frame::StreamKey;
6
7/// Error type for registry operations
8#[derive(Debug, Clone)]
9pub enum RegistryError {
10    /// Stream not found
11    StreamNotFound(StreamKey),
12    /// Stream already has a publisher
13    StreamAlreadyPublishing(StreamKey),
14    /// Publisher ID mismatch
15    PublisherMismatch,
16    /// Stream is not active (e.g., in grace period without publisher)
17    StreamNotActive(StreamKey),
18}
19
20impl std::fmt::Display for RegistryError {
21    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22        match self {
23            RegistryError::StreamNotFound(key) => write!(f, "Stream not found: {}", key),
24            RegistryError::StreamAlreadyPublishing(key) => {
25                write!(f, "Stream already has a publisher: {}", key)
26            }
27            RegistryError::PublisherMismatch => write!(f, "Publisher ID mismatch"),
28            RegistryError::StreamNotActive(key) => write!(f, "Stream not active: {}", key),
29        }
30    }
31}
32
33impl std::error::Error for RegistryError {}