fluxion_core/
subject_error.rs

1// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
2// Licensed under the Apache License, Version 2.0
3// http://www.apache.org/licenses/LICENSE-2.0
4
5use core::fmt;
6
7/// Errors specific to subject operations (lifecycle and broadcasting).
8///
9/// These errors represent subject-specific failures distinct from stream processing errors.
10/// They can be converted to `FluxionError` when needed for stream propagation.
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub enum SubjectError {
13    /// The subject has been closed and cannot accept new items.
14    Closed,
15}
16
17impl fmt::Display for SubjectError {
18    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19        match self {
20            Self::Closed => write!(f, "Subject is closed"),
21        }
22    }
23}
24
25impl core::error::Error for SubjectError {}