Skip to main content

libfcp_server/
error.rs

1// Copyright Nixort <https://github.com/Nixort> 2026.
2//
3// License: GNU General Public License v3.0 only.
4// You can find the license file in the project root.
5//
6// Federated CFR Connect Protocol (FCP).
7
8//! Server-side federation configuration errors.
9
10use core::fmt;
11
12/// Configuration authority failure.
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum Error {
15    /// A replacement did not advance the configuration epoch.
16    NonIncreasingEpoch,
17    /// The shared canonical configuration rejected the requested member set.
18    Core(libfcp_core::Error),
19}
20
21impl From<libfcp_core::Error> for Error {
22    fn from(error: libfcp_core::Error) -> Self {
23        Self::Core(error)
24    }
25}
26
27impl fmt::Display for Error {
28    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
29        write!(formatter, "fcp server error: {self:?}")
30    }
31}
32
33#[cfg(feature = "std")]
34impl std::error::Error for Error {}